Sine Function I'm trying to Plot won't show up
4 ビュー (過去 30 日間)
古いコメントを表示
I am trying to plot the sine based function with various constants. However, when I try to plot them nothing shows up in the figure window, and the variables in the workspace only evaluate to one number rather than the whole range of phi. Not sure what I'm doing wrong here.
0 件のコメント
採用された回答
Stephen23
2022 年 9 月 22 日
編集済み: Stephen23
2022 年 9 月 22 日
"Not sure what I'm doing wrong here."
You need to use element-wise division, not matrix division:
phi = 0:0.1:6*pi;
I2 = sin(phi).^2 ./ sin(phi/2).^2;
% ^^
plot(I2)
Tip: if you are not doing linear algebra you probably should be using array operations:
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!