| 5 | 1/1 | 返回列表 |
| 查看: 2203 | 回復(fù): 4 | ||||
| 當(dāng)前只顯示滿足指定條件的回帖,點(diǎn)擊這里查看本話題的所有回帖 | ||||
劉小嵩321銀蟲(chóng) (著名寫(xiě)手)
|
[求助]
matlab出現(xiàn)問(wè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)為時(shí)間零點(diǎn),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í)行命令時(shí)出現(xiàn): 錯(cuò)誤使用 lsqcurvefit (line 181) LSQCURVEFIT requires the following inputs to be of data type double: 'LB'. 出錯(cuò) Untitled2 (line 9) [x,resnorm,residual,exitflag,output]=lsqcurvefit(@fun,x0,xdata,ydata,options); 應(yīng)該如何修改? |
金蟲(chóng) (初入文壇)
榮譽(yù)版主 (著名寫(xiě)手)
![]() |
專家經(jīng)驗(yàn): +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); |

銀蟲(chóng) (著名寫(xiě)手)
|
還是報(bào)錯(cuò), 出錯(cuò) 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. |
銀蟲(chóng) (著名寫(xiě)手)
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 一志愿西安交通大學(xué)材料工程專業(yè) 282分求調(diào)劑 +10 | 楓橋ZL 2026-03-18 | 12/600 |
|
|---|---|---|---|---|
|
[考研] 化學(xué)工程321分求調(diào)劑 +18 | 大米飯! 2026-03-15 | 22/1100 |
|
|
[考研] 材料與化工(0856)304求B區(qū)調(diào)劑 +3 | 邱gl 2026-03-20 | 7/350 |
|
|
[考研] 一志愿南大,0703化學(xué),分?jǐn)?shù)336,求調(diào)劑 +3 | 收到VS 2026-03-21 | 3/150 |
|
|
[考研] 313求調(diào)劑 +4 | 肆叁貳壹22 2026-03-19 | 4/200 |
|
|
[考研] 22 350 本科985求調(diào)劑,求老登收留 +3 | 李軼男003 2026-03-20 | 3/150 |
|
|
[考研] 332求調(diào)劑 +3 | 鳳凰院丁真 2026-03-20 | 3/150 |
|
|
[考研] 085601調(diào)劑 358分 +3 | zzzzggh 2026-03-20 | 4/200 |
|
|
[考研] 一志愿天津大學(xué)化學(xué)工藝專業(yè)(081702)315分求調(diào)劑 +12 | yangfz 2026-03-17 | 12/600 |
|
|
[考研] 二本跨考鄭大材料306英一數(shù)二 +3 | z1z2z3879 2026-03-17 | 3/150 |
|
|
[考研] 一志愿華南師大 070300(化學(xué))304分求調(diào)劑 +3 | 0703武芊慧雪304 2026-03-18 | 3/150 |
|
|
[考研] 295求調(diào)劑 +4 | 一志愿京區(qū)211 2026-03-18 | 6/300 |
|
|
[考研] 考研調(diào)劑求學(xué)校推薦 +3 | 伯樂(lè)29 2026-03-18 | 5/250 |
|
|
[考研] 一志愿武漢理工材料工程專碩調(diào)劑 +9 | Doleres 2026-03-19 | 9/450 |
|
|
[考研] 【同濟(jì)軟件】軟件(085405)考研求調(diào)劑 +3 | 2026eternal 2026-03-18 | 3/150 |
|
|
[考研] 312求調(diào)劑 +8 | 陌宸希 2026-03-16 | 9/450 |
|
|
[考研] 0703化學(xué)調(diào)劑 +3 | 妮妮ninicgb 2026-03-17 | 3/150 |
|
|
[考博] 26博士申請(qǐng) +3 | 1042136743 2026-03-17 | 3/150 |
|
|
[考研] 302求調(diào)劑 +4 | 小賈同學(xué)123 2026-03-15 | 8/400 |
|
|
[考研] [導(dǎo)師推薦]西南科技大學(xué)國(guó)防/材料導(dǎo)師推薦 +3 | 尖角小荷 2026-03-16 | 6/300 |
|