why do I get the wrong angle

why do i keep getting a negatie value for angle

1 件のコメント

Torsten
Torsten 2022 年 6 月 14 日
Why did you delete your question ?

サインインしてコメントする。

回答 (1 件)

David Hill
David Hill 2022 年 6 月 14 日
編集済み: David Hill 2022 年 6 月 14 日

0 投票

Recommend avoiding using symbolics. Seeking numerical solution, use fzero.
mo=2.5;
y=1.4;
angle=10;
fun=@(a)((2*(1+((y-1)/2)*mo^2*(sind(a)).^2))./(((y+1)*mo^2*sind(a).*cosd(a))))-tand(a-angle);
A=fzero(fun,32);

3 件のコメント

Sarah Alhabbas
Sarah Alhabbas 2022 年 6 月 14 日
I appreciate your response.
However, the code should give the ouput answer as 32 so it should not be included in the code.
David Hill
David Hill 2022 年 6 月 14 日
You could also plot and see that there are two solutions between (0 - 90).
mo=2.5;
y=1.4;
angle=10;
fun=@(a)((2*(1+((y-1)/2)*mo^2*(sind(a)).^2))./(((y+1)*mo^2*sind(a).*cosd(a))))-tand(a-angle);
x=3:.1:87;
plot(x,fun(x));
David Hill
David Hill 2022 年 6 月 14 日
編集済み: David Hill 2022 年 6 月 14 日
When you graph the function you see solutions should be around 30 and 80. fzero requires an initial guess. 32 is not an exact solution.
mo=2.5;
y=1.4;
angle=10;
fun=@(a)((2*(1+((y-1)/2)*mo^2*(sind(a)).^2))./(((y+1)*mo^2*sind(a).*cosd(a))))-tand(a-angle);
A=fzero(fun,30)
A = 31.8506
mo=2.5;
y=1.4;
angle=10;
fun=@(a)((2*(1+((y-1)/2)*mo^2*(sind(a)).^2))./(((y+1)*mo^2*sind(a).*cosd(a))))-tand(a-angle);
A=fzero(fun,80)
A = 85.5761

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

タグ

質問済み:

2022 年 6 月 14 日

コメント済み:

2022 年 6 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by