Azzera filtri
Azzera filtri

value search using functions

2 visualizzazioni (ultimi 30 giorni)
harley
harley il 21 Ago 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));

Risposta accettata

Walter Roberson
Walter Roberson il 21 Ago 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.)

Più risposte (0)

Categorie

Scopri di più su Optimization in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by