国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Matlab--函數(shù)擬合、Dijkstra算法

2022-12-29 19:59 作者:洛溪い  | 我要投稿

函數(shù)擬合

題目:

題目1

代碼:

>> x=[0,34,67,101,135,202,259,336,404,471];

>> y=[15.18,21.36,25.72,32.29,34.03,39.45,43.18,43.46,40.83,30.75];

function [fitresult, gof] = createFit(x, y)

[xData, yData] = prepareCurveData( x, y );

ft = fittype( 'gauss1' );

opts = fitoptions( 'Method', 'NonlinearLeastSquares' );

opts.Display = 'Off';

opts.Lower = [-Inf -Inf 0];

opts.StartPoint = [43.46 336 210.279614505574];

[fitresult, gof] = fit( xData, yData, ft, opts );

figure( 'Name', '無標(biāo)題擬合 1' );

h = plot( fitresult, xData, yData );

legend( h, 'y vs. x', '無標(biāo)題擬合 1', 'Location', 'NorthEast', 'Interpreter', 'none' );

xlabel( 'x', 'Interpreter', 'none' );

ylabel( 'y', 'Interpreter', 'none' );

grid on

Dijkstra算法:

題目:

題目2

代碼:

clc,clear all

a=zeros(8);

a(1,2)=4;a(1,3)=6;

a(2,4)=5;a(2,5)=4;

a(3,4)=4;a(3,5)=7;

a(4,6)=9;a(4,7)=7;

a(5,6)=5;a(5,7)=6;

a(6,8)=4;a(6,7)=5;

a(7,8)=1;

a=a+a'

a(find(a==0))=inf

pb(1:length(a))=0;pb(1)=1;

index1=1;?

index2=ones(1,length(a));

d(1:length(a))=inf;d(1)=0;

temp=1;

while sum(pb)<length(a)

tb=find(pb==0);

d(tb)=min(d(tb),d(temp)+a(temp,tb));

tmpb=find(d(tb)==min(d(tb)));

temp=tb(tmpb(1));

pb(temp)=1;

index1=[index1,temp];

temp2=find(d(index1)==d(temp)-a(temp,index1));

index2(temp)=index1(temp2(1));

end

d,index1,index2

Matlab--函數(shù)擬合、Dijkstra算法的評論 (共 條)

分享到微博請遵守國家法律
井研县| 上林县| 萍乡市| 杭锦后旗| 石林| 顺昌县| 如东县| 南岸区| 平遥县| 广宁县| 东阳市| 页游| 扶沟县| 鸡泽县| 都江堰市| 太仆寺旗| 湖北省| 阳山县| 平顶山市| 富裕县| 宁明县| 泾阳县| 从江县| 犍为县| 富民县| 公主岭市| 保定市| 东丽区| 江阴市| 崇义县| 休宁县| 通州市| 巴林右旗| 商都县| 新民市| 光泽县| 东乌珠穆沁旗| 马公市| 敦化市| 田林县| 遵义县|