Problem with nested function structure by using "fminsearch" command.
古いコメントを表示
Hello,
I'm trying to minimize a function which is RMSE between two data series of temperature measured and calculated. I believe there is something wrong in the way i have organized the nested function structure. Below i carry over a shortened version of the script, thank you very much.
function [x,lambda_filt,lambda]=prova1(x,TRT)
%TRT is the matrix i need to bring all data specially the temperatre measured
opt = optimset ( 'Display' , 'iter','MaxIter' ,2 );
[x, fval, exitflag, output] = fminsearch ( @margin,x,opt )
function w=margin(x)
for index=1:length(tempo) % tempo is inside TRT
T_calculated(index)= (Q/H)./(4.*pi.*sqrt(x(1).*x(1))).*exp( (row.*cw.*q.*r_bw)./ (2.*x(1) )).*quad(@(phi) (exp(-phi-(((r_bw.^2)./x(1)) + ((r_bw.^2)./x(1))).*(((row.*cw.*q).^2)./(16.*x(1).*phi))).*(1./phi)),0,(((row.*cw.*q).^2).*tempo(index))./(4.*ro.*c.*x(1)))+x(2)+((Q/H)*Rb);
end
misfit=(T_calculated-T_measured).^2;
w= sqrt(sum(misfit)./length(tempo));
end
figure;
plot(tempo,T_calculated,tempo,T_measured,'r');
end
1 件のコメント
Matt J
2014 年 2 月 21 日
I believe there is something wrong in the way i have organized the nested function structure.
What leads you to believe that?
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Entering Commands についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!