Error using fzero (line 184) FUN must be a function, a valid character vector expression, or an inline function object. What is the issue here?

vi = 600;
v = 0:0.01:1000;
sig = input('Input sigma value: ');
w = input('Input weight of airfoil: ');
f = @(v) 0.01*sig*v.^2 + (0.95/sig)*((w.^2)./(v.^2));
fvi = f(vi);
root = fzero(fvi, vi)
I have no idea why I'm encountering this error, can someone please help me.

댓글 수: 1

Actually nvm I made a silly mistake, this does not cross the x axis, its derivative does. got confused my bad.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2021년 10월 1일
편집: Jan 2021년 10월 1일
v is the variable of the function. You do not have to deine it as a vector.
fzero expects a function handle, but f(vi) is a number.
vi = 600;
sig = input('Input sigma value: ');
w = input('Input weight of airfoil: ');
f = @(v) 0.01*sig*v.^2 + (0.95/sig)*((w.^2)./(v.^2));
root = fzero(f, vi)

댓글 수: 1

Yeah I realised this too, fixed it up a few hours ago:
vi = 500;
sig = input('Input sigma value: ');
w = input('Input weight of airfoil: ');
f = @(v) 0.02*sig*v - (1.90/sig)*((w^2)/(v^3)); %deriv. of Drag Eqn
dfdv = @(v) 0.02*sig + (5.70/sig)*((w^2)/(v^4)); %double deriv. of Drag Eqn
fvi = f(vi);
mi = dfdv(vi);
while abs(fvi) > 0
vi_new = vi - fvi/mi;
vi = vi_new
fvi = f(vi);
mi = dfdv(vi);
end
root = fzero(f, 600)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Airfoil tools에 대해 자세히 알아보기

질문:

2021년 10월 1일

댓글:

2021년 10월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by