Filter löschen
Filter löschen

Error in fzero function

1 Ansicht (letzte 30 Tage)
strunack
strunack am 27 Nov. 2012
I have a function
function F = myfun(x,xdata)
F =x(1)*sin((2*pi/x(2))*xdata+x(3));
with lsqrcurvefit i got x=[0.3559 14.2775 0.6573]
the function has several zero crossing. I want to find the zerocrossing in the interval of [t1 t2]
I used like this
findzero=fzero(@myfun(x,xdata),[-12 -7])
or
findzero=fzero(myfun(x,xdata),-8.5)
but it says error. it does nt take the command I have to pass x into myfun but it doesnt accept.
xdata is just a time series xdata=[-25:0.01:25]
pls help

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 27 Nov. 2012
findzero=fzero(@(x) myfun(x,xdata),[-12 -7])

Weitere Antworten (0)

Kategorien

Mehr zu Optimization finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by