plotting one variable equation
古いコメントを表示
i want to plot "w" on x- axis and "a" on y- axis. I am not getting the plot. The code used is:
for w = -600:100:-100
a=sqrt(((1200./(w.^2))+10)/((300./(w.^2))+1));
end
plot(w, a)
2 件のコメント
priya
2021 年 9 月 8 日
Sajid Afaque
2021 年 9 月 8 日
probably because you are overwriting a each time.
a stores last iteration value , hence you are plotting only single value of a.
store a as array, it will solve your issue
採用された回答
その他の回答 (1 件)
wvals = -600:100:-100;
numw = length(wvals);
a = zeros(1,numw);
for widx = 1 : numw
w = wvals(widx);
a(widx) = sqrt((1200/w.^2)+10)/sqrt((300/w.^2)+1);
end
plot(wvals, a)
カテゴリ
ヘルプ センター および File Exchange で 2-D and 3-D Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

