| 5 | 1/1 | 返回列表 |
| 查看: 2202 | 回復: 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); 應該如何修改? |
銀蟲 (著名寫手)
|
還是報錯, 出錯 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. |
榮譽版主 (著名寫手)
![]() |
專家經驗: +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); |

銀蟲 (著名寫手)
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 269專碩求調劑 +5 | 金恩貝 2026-03-21 | 5/250 |
|
|---|---|---|---|---|
|
[考研] 材料求調劑 +5 | @taotao 2026-03-21 | 5/250 |
|
|
[考研] 材料工程專碩 348分求調劑 +3 | 冬辭. 2026-03-17 | 5/250 |
|
|
[考研] 工科0856求調劑 +3 | 沐析汀汀 2026-03-21 | 3/150 |
|
|
[考研] 求調劑 +3 | 13341 2026-03-20 | 3/150 |
|
|
[考研] 317求調劑 +9 | 申子申申 2026-03-19 | 15/750 |
|
|
[考研] 310求調劑 +3 | baibai1314 2026-03-16 | 3/150 |
|
|
[考研] 332求調劑 +4 | ydfyh 2026-03-17 | 4/200 |
|
|
[考研] 085700資源與環(huán)境308求調劑 +12 | 墨墨漠 2026-03-18 | 13/650 |
|
|
[考研] 330求調劑 +4 | 小材化本科 2026-03-18 | 4/200 |
|
|
[考研] 290求調劑 +7 | ^O^乜 2026-03-19 | 7/350 |
|
|
[考研] 北科281學碩材料求調劑 +5 | tcxiaoxx 2026-03-20 | 5/250 |
|
|
[考研] 一志愿 南京航空航天大學大學 ,080500材料科學與工程學碩 +5 | @taotao 2026-03-20 | 5/250 |
|
|
[考研] 353求調劑 +3 | 拉鉤不許變 2026-03-20 | 3/150 |
|
|
[考研] 08工學調劑 +5 | 用戶573181 2026-03-20 | 5/250 |
|
|
[考研] 298-一志愿中國農業(yè)大學-求調劑 +9 | 手機用戶 2026-03-17 | 9/450 |
|
|
[論文投稿]
申請回稿延期一個月,編輯同意了。但系統(tǒng)上的時間沒變,給編輯又寫郵件了,沒回復
10+3
|
wangf9518 2026-03-17 | 4/200 |
|
|
[考研] 考研調劑 +3 | 淇ya_~ 2026-03-17 | 5/250 |
|
|
[考研] 283求調劑 +3 | 聽風就是雨; 2026-03-16 | 3/150 |
|
|
[考研] 333求調劑 +3 | 文思客 2026-03-16 | 7/350 |
|