필터 지우기
필터 지우기

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(fun​fcn,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
Matt J 2016년 6월 1일
You need to pass a handle to the objective function
[q]=fminsearch(@minimizza_x_tau,0.24);

카테고리

Help CenterFile 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!

Translated by