Hi,
Here is my code below, I want to compute and plot (del2,del) for each value of V. How can I make a loop here?
V = [0.5 1 2 3 4 6 10];
del = 0:10:90;
del_r = del.*pi./180;
for i=V(:,1):V(:,end)
x = V(:,i).*tan(del_r);
end
del_r2 = atan(x);
del2 = del_r2*180./pi;
figure, plot(del2,del) % plot for each value of V

 採用された回答

Torsten
Torsten 2022 年 10 月 9 日
編集済み: Torsten 2022 年 10 月 9 日

0 投票

V = [0.5 1 2 3 4 6 10].';
del = 0:1:90;
del_r = del.*pi./180;
x = V.*tan(del_r);
del_r2 = atan(x);
del2 = del_r2*180./pi;
figure(1)
plot(del2,del)
figure(2)
del2 = atand(V.*tand(del));
plot(del2,del)
tot = sind(del2)./sind(del);
figure(3)
plot(tot.',del2.')

3 件のコメント

Nisar Ahmed
Nisar Ahmed 2022 年 10 月 9 日
編集済み: Nisar Ahmed 2022 年 10 月 9 日
@Torsten Thanks, how to display legends? and if I compute further tot = sin(del2)./sin(del) and the plot(tot,del2); Is the correct way to compute and plot 7 curves?
Torsten
Torsten 2022 年 10 月 9 日
編集済み: Torsten 2022 年 10 月 9 日
Thanks, how to display legends?
and if I compute further tot = sin(del2)./sin(del) and the plot(tot,del2); Is the correct way to compute and plot 7 curves?
Check above whether this is really what you want to plot.
You plot f(x) = atan(V.*tan(x)) against g(x) = sin(atan(V.*tan(x)))/sin(x) - quite unusual, I think. And for x=0 you get NaN for g(x).
And use sind, cosd, tand, asind, acosd, atand as trigonometric functions instead of sin, cos, tan, asin, acos, atan as you work in degrees, not radians.
Nisar Ahmed
Nisar Ahmed 2022 年 10 月 9 日
@Torsten Thanks

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

質問済み:

2022 年 10 月 9 日

編集済み:

2022 年 10 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by