Error using fcnchk (line 106) FUN must be a function, a valid string expression, or an inline function object. Error in fminsearch (line 162) funfcn = fcnchk(funfcn,length(varargin));
17 ビュー (過去 30 日間)
古いコメントを表示
Hi,i'm new,it's urgent!
i have this problem: i created a function
function [ q ] = minimizza_x_tau(tc);
load('datinuovi.mat')
fsamp=50;
N=length(Datitermocoppia) ;
t=[0:1/fsamp:N/fsamp-1/fsamp];
salto=max(Datitermocoppia)-min(Datitermocoppia);
y=salto.*(1-exp(-t./tc));
y2=rot90(y);
diffe=(Datitermocoppia-y2).^2;
q=sum(diffe);
end
when i call the function from the script for example with
tc=2;
[taunew]=minimizza_x_tau(tc);
it works, but it is not i have to do.
i have to do a minimization as it:
tc=2;
[q]=fminsearch(minimizza_x_tau(tc),0.24);
If i do that it says me ERRORS above.
you know why? i don't know if put tc=2 is right i put them for example.
thank you
回答 (1 件)
Matt J
2016 年 6 月 1 日
You need to pass a handle to the objective function
[q]=fminsearch(@minimizza_x_tau,0.24);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with Optimization Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!