[問題] lsqcurvefit請教
餓死抬頭
function F = myfun(x,xdata)
Area = 481;
xlsFile = 'test.xls';
R = xlsread(xlsFile,1,'B2:B88');
for jj = 1:length(xdata);
A = 1;
for kk = jj:-1:1
qn(1,A) = (R(A,1)/x)*exp(-xdata(kk,1)/x)*Area*10^4/3600;
A = A+1;
end
end
F = sum(qn,2); %模擬值
end
以上是小弟的方程式
-----------------------------------------------
xlsFile = 'test.xls';
xdata = (xlsread(xlsFile,1,'A2:A88'))';
ydata = (xlsread(xlsFile,1,'D2:D88'))';
x0 = [2.39];
[x,resnorm] = lsqcurvefit(@myfun,x0,xdata,ydata)
上面是我執行的M檔
可是在執行的時候會出現
Failure in initial user-supplied objective
function evaluation. LSQCURVEFIT cannot
continue.
不知道是不是哪邊寫錯了
方程式的部分比較複雜 會隨著時間增加慢慢變長
如t = 1, F = R1/x*exp(-t1/x)
t = 2, F = R1/x*exp(-t2/x)+R2/x*exp(-t1/x)
t = n, F = R1/x*exp(-tn/x)+R2/x*exp(-tn-1/x)+...+Rn/x*exp(-t1/x)
R的順序和t的順序是相反的 而且是已知數 x是想要求的未知數
網路上大部分都是找到長度固定的模擬方程式
不知道這種長度會變動的要如何算><
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.239.232.104
※ 文章網址: https://www.ptt.cc/bbs/MATLAB/M.1423250213.A.1A3.html
※ 編輯: w12389034e (36.239.216.124), 02/07/2015 03:30:00
→
02/07 03:41, , 1F
02/07 03:41, 1F
→
02/07 03:46, , 2F
02/07 03:46, 2F
→
02/07 03:46, , 3F
02/07 03:46, 3F
→
02/07 03:46, , 4F
02/07 03:46, 4F
→
02/07 14:42, , 5F
02/07 14:42, 5F
MATLAB 近期熱門文章
PTT數位生活區 即時熱門文章