필터 지우기
필터 지우기

how to use fzero?

조회 수: 1 (최근 30일)
Qasim Manzoor
Qasim Manzoor 2013년 10월 22일
댓글: Matt J 2013년 10월 22일
the code im trying to run is
m1=input('Enter Mach number=');
y=input('Enter the Specific Heat ratio of working fluid=');
ang=input('Enter theta =');
syms b
t=ang*(pi/180);
f=tan(t)-2*cot(b)*((((m1^2)*(sin(b))^2)-1)/((m1^2*(y+cos(2*b)))+2));
fzero(f,25)
what i actually need is to find the value of b which makes the function "f" zero where t,m1 and y are numerical values. so i need to solve the above equation for b. any tips how i can do this?

채택된 답변

Matt J
Matt J 2013년 10월 22일
Omit the symbolic operations, if you plan to solve numerically
m1=input('Enter Mach number=');
y=input('Enter the Specific Heat ratio of working fluid=');
ang=input('Enter theta =');
t=ang*(pi/180);
f=@(b) tan(t)-2*cot(b)*((((m1^2)*(sin(b))^2)-1)/((m1^2*(y+cos(2*b)))+2));
fzero(f,25)
  댓글 수: 2
Qasim Manzoor
Qasim Manzoor 2013년 10월 22일
does that mean that fzero isnt compatible with syms?
Matt J
Matt J 2013년 10월 22일
편집: Matt J 2013년 10월 22일
That's right, it is not a symbolic solver. For that you would use solve(). However, there doesn't appear to be any reason to be doing symbolic computations in this situation.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by