value search using functions

2 visualizaciones (últimos 30 días)
harley
harley el 21 de Ag. de 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));

Respuesta aceptada

Walter Roberson
Walter Roberson el 21 de Ag. de 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.)

Más respuestas (0)

Categorías

Más información sobre Optimization en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by