| 5 | 1/1 | 返回列表 |
| 查看: 2201 | 回復(fù): 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); 應(yīng)該如何修改? |
榮譽版主 (著名寫手)
![]() |
專家經(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)劑 +12 | 墨墨漠 2026-03-18 | 13/650 |
|
|---|---|---|---|---|
|
[考研] 材料專業(yè)求調(diào)劑 +6 | hanamiko 2026-03-18 | 6/300 |
|
|
[考研] 一志愿武漢理工材料工程專碩調(diào)劑 +9 | Doleres 2026-03-19 | 9/450 |
|
|
[考研] 藥學(xué)383 求調(diào)劑 +3 | 藥學(xué)chy 2026-03-15 | 5/250 |
|
|
[考研] 中南大學(xué)化學(xué)學(xué)碩337求調(diào)劑 +3 | niko- 2026-03-19 | 6/300 |
|
|
[考研] 一志愿西安交通大學(xué) 學(xué)碩 354求調(diào)劑 +3 | 我想要讀研究生 2026-03-20 | 3/150 |
|
|
[考研] 招收調(diào)劑碩士 +4 | lidianxing 2026-03-19 | 12/600 |
|
|
[考研] 0703化學(xué)調(diào)劑 +4 | 18889395102 2026-03-18 | 4/200 |
|
|
[考研] 085600材料與化工調(diào)劑 324分 +10 | llllkkkhh 2026-03-18 | 12/600 |
|
|
[考研] 本科鄭州大學(xué)物理學(xué)院,一志愿華科070200學(xué)碩,346求調(diào)劑 +4 | 我不是一根蔥 2026-03-18 | 4/200 |
|
|
[考研] 085601專碩,總分342求調(diào)劑,地區(qū)不限 +5 | share_joy 2026-03-16 | 5/250 |
|
|
[考研] 085601求調(diào)劑 +4 | Du.11 2026-03-16 | 4/200 |
|
|
[考研] 290求調(diào)劑 +3 | p asserby. 2026-03-15 | 4/200 |
|
|
[考研] 一志愿蘇州大學(xué)材料工程(085601)專碩有科研經(jīng)歷三項國獎兩個實用型專利一項省級立項 +6 | 大火山小火山 2026-03-16 | 8/400 |
|
|
[考博] 26申博 +4 | 八6八68 2026-03-16 | 4/200 |
|
|
[論文投稿] 有沒有大佬發(fā)小論文能帶我個二作 +3 | 增銳漏人 2026-03-17 | 4/200 |
|
|
[考研] 一志愿,福州大學(xué)材料專碩339分求調(diào)劑 +3 | 木子momo青爭 2026-03-15 | 3/150 |
|
|
[考研] 機械專碩325,尋找調(diào)劑院校 +3 | y9999 2026-03-15 | 5/250 |
|
|
[考研] 0703化學(xué)調(diào)劑 290分有科研經(jīng)歷,論文在投 +7 | 膩膩gk 2026-03-14 | 7/350 |
|
|
[考研] 復(fù)試調(diào)劑 +3 | 呼呼?~+123456 2026-03-14 | 3/150 |
|