필터 지우기
필터 지우기

Problem with nested function structure by using "fminsearch" command.

조회 수: 3 (최근 30일)
Gianmario
Gianmario 2014년 2월 21일
댓글: Matt J 2014년 2월 21일
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
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개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by