value search using functions

2 Ansichten (letzte 30 Tage)
harley
harley am 21 Aug. 2013
how do i use the fzero function or any other MATLAB function to find/verify the value of 'a', like i have done using the cubic spline method. (i am pretending that i don't know what that value is)
a=5;
w=-a:a/1000:a;
F=2*sin(a*w)./w;
%
%
w_int=-5:0.01:5;
F_int=spline(w,F,w_int);
plot(w_int,F_int,'o');
plot(w,F, '--', w_int,F_int,'o')
c = max(F_int);
[~, idx] = min(abs(w_int - 0.005));
d = w_int(idx);
a1 = (c*d)/(2*sin(d));

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 21 Aug. 2013
You cannot do that. fzero() is based upon the assumption that when upper and lower bounds are provided, that they are constant, not values that vary according to the current "x" value. (Your "w" varies from -a to +a rather than being fixed.)

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