필터 지우기
필터 지우기

value search using functions

조회 수: 2 (최근 30일)
harley
harley 2013년 8월 21일
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));

채택된 답변

Walter Roberson
Walter Roberson 2013년 8월 21일
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.)

추가 답변 (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