Error in fzero function

1 次查看(过去 30 天)
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

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Optimization 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by