| 5 | 1/1 | 返回列表 |
| 查看: 2200 | 回復: 4 | ||||
劉小嵩321銀蟲 (著名寫手)
|
[求助]
matlab出現(xiàn)問題 已有2人參與
|
|
1 function deconvolution 2 data=load('0.10-645.dat'); 3 xdata=data(:,1); 4 ydata=data(:,2); 5 x0=[0.1]; 6 %x(1)為脈寬,x(2)為時間零點,x(3)為A1,x(4)為t1,x(5)為A2,x(6)為t2 7 %----------------------------------------------------------- 8 options=optimset('TolFun',1e-4,'TolX',1e-4,'MaxIter',1e9,'MaxFunEvals',1e9); 9 [x,resnorm,residual,exitflag,output]=lsqcurvefit(@fun,x0,xdata,ydata,options); 10 disp('the fitted parameter is delta mu A1 tau1 A2 tau2)');disp(x);11 disp('the resnorm is:');disp(resnorm); 12 disp('the exit flag is:');disp(exitflag); 13 disp(output); 14 %--------------------------------------------------------------------------fit 15 Fp=fun(x,xdata); 16 irf=-1*2*sqrt(log(2))/0.06/sqrt(pi)*exp(-log(2)*(2*(xdata-x(2))/x(1)).^2)/20; 17 subplot(2,1,1); plot(data(:,1),Fp,'b-',xdata,ydata,'ro',xdata,irf,'g'); 18 subplot(2,1,2); plot(data(:,1),residual,'g*'); 19 %------------------------------------------------------------------------- 20 result=[xdata ydata Fp residual irf]; 21 save -ASCII -DOUBLE result.dat result; 22 y=[x resnorm]; 23 save -ASCII -DOUBLE parameters.dat y; 24 function F=fun(x,xdata) 25 delta1=x(1)/(sqrt(log(4))); 26 F1=x(3).*exp(delta1^2/x(4)^2/2).*exp(-(xdata-x(2))/x(4)).*(1+erf(((xdata-x(2))/delta1-delta1/x(4))/sqrt(2))); 27 F2=x(5).*(1+erf((xdata-x(7))/sqrt(2)/delta1)-exp(delta1^2/x(6)^2/2).*exp(-(xdata-x(7))/x(6)).*(1+erf(((xdata-x(7))/delta1-delta1/x(6))/sqrt(2)))); 28 F=F1+F2; 執(zhí)行命令時出現(xiàn): 錯誤使用 lsqcurvefit (line 181) LSQCURVEFIT requires the following inputs to be of data type double: 'LB'. 出錯 Untitled2 (line 9) [x,resnorm,residual,exitflag,output]=lsqcurvefit(@fun,x0,xdata,ydata,options); 應該如何修改? |
榮譽版主 (著名寫手)
![]() |
專家經(jīng)驗: +4 |
|
X = lsqcurvefit(FUN,X0,XDATA,YDATA,LB,UB,OPTIONS) minimizes with the default parameters replaced by values in the structure OPTIONS, an argument created with the OPTIMSET function. See OPTIMSET for details. Use the Jacobian option to specify that FUN also returns a second output argument J that is the Jacobian matrix at the point X. If FUN returns a vector F of m components when X has length n, then J is an m-by-n matrix where J(i,j) is the partial derivative of F(i) with respect to x(j). (Note that the Jacobian J is the transpose of the gradient of F.) 改為[x,resnorm,residual,exitflag,output]=lsqcurvefit(@fun,x0,xdata,ydata,[],[],options); |

銀蟲 (著名寫手)
|
還是報錯, 出錯 Untitled2 (line 9) [x,resnorm,residual,exitflag,output]=lsqcurvefit(@fun,x0,xdata,ydata,[],[],options); 原因: Failure in initial user-supplied objective function evaluation. LSQCURVEFIT cannot continue. |
銀蟲 (著名寫手)
| 5 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 一志愿重慶大學085700資源與環(huán)境專碩,總分308求調(diào)劑 +3 | 墨墨漠 2026-03-18 | 3/150 |
|
|---|---|---|---|---|
|
[考研] 一志愿西南交大,求調(diào)劑 +5 | 材化逐夢人 2026-03-18 | 5/250 |
|
|
[考研] 274求調(diào)劑 +10 | S.H1 2026-03-18 | 10/500 |
|
|
[考研] 一志愿蘇州大學材料求調(diào)劑,總分315(英一) +5 | sbdksD 2026-03-19 | 5/250 |
|
|
[考研] 295材料求調(diào)劑,一志愿武漢理工085601專碩 +5 | Charlieyq 2026-03-19 | 5/250 |
|
|
[考研] 289求調(diào)劑 +6 | 懷瑾握瑜l 2026-03-20 | 6/300 |
|
|
[考研] 材料學求調(diào)劑 +4 | Stella_Yao 2026-03-20 | 4/200 |
|
|
[考研] 353求調(diào)劑 +3 | 拉鉤不許變 2026-03-20 | 3/150 |
|
|
[考研] 一志愿吉林大學材料學碩321求調(diào)劑 +11 | Ymlll 2026-03-18 | 15/750 |
|
|
[考研] 085410人工智能專碩317求調(diào)劑(0854都可以) +4 | xbxudjdn 2026-03-18 | 4/200 |
|
|
[論文投稿]
申請回稿延期一個月,編輯同意了。但系統(tǒng)上的時間沒變,給編輯又寫郵件了,沒回復
10+3
|
wangf9518 2026-03-17 | 4/200 |
|
|
[考研] 一志愿西安交通大學材料工程專業(yè) 282分求調(diào)劑 +5 | 楓橋ZL 2026-03-18 | 7/350 |
|
|
[考研] 324分 085600材料化工求調(diào)劑 +3 | llllkkkhh 2026-03-18 | 3/150 |
|
|
[考研] 一志愿蘇州大學材料工程(085601)專碩有科研經(jīng)歷三項國獎兩個實用型專利一項省級立項 +6 | 大火山小火山 2026-03-16 | 8/400 |
|
|
[考研] 326求調(diào)劑 +4 | 諾貝爾化學獎覬?/a> 2026-03-15 | 7/350 |
|
|
[考研] 一志愿211 0703方向310分求調(diào)劑 +3 | 努力奮斗112 2026-03-15 | 3/150 |
|
|
[考研] 321求調(diào)劑 +5 | 大米飯! 2026-03-15 | 5/250 |
|
|
[考研] 070300化學學碩求調(diào)劑 +6 | 太想進步了0608 2026-03-16 | 6/300 |
|
|
[考研] 326求調(diào)劑 +3 | mlpqaz03 2026-03-15 | 3/150 |
|
|
[考研] 288求調(diào)劑 +4 | 奇點0314 2026-03-14 | 4/200 |
|