How to plot multiple graphs using different values for one of the variables?

51 ビュー (過去 30 日間)
Ahmed Ahmed
Ahmed Ahmed 2022 年 3 月 22 日
回答済み: VBBV 2022 年 3 月 22 日
I am trying to plot frequency (f) vs alphat for different values of alphat. frequency is always a vector from 100 to 10,000 with increments of 100, given that the value of alphat changes for every differet value of sigmaR. My code is only plotting the first value of sigmaR (20). The goal is to have 6 different graphs one for each value of sigmaR but I am only getting one
clear all;
clc;
f=100:100:10000;
for sigmaR=20,60,8,450,35,5 ;
alphat=20.*log10(sigmaR.*f)-42.4
plot(f,alphat)
end

採用された回答

VBBV
VBBV 2022 年 3 月 22 日
for sigmaR=[20,60,8,450,35,5] % put this in [ ]
plot(f,alphat)
hold on
end
Put the loop vector in [ ] and use hold on after plot

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 3 月 22 日
hold on
after the plot() call.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by