How to graph plots with different value variables?

5 ビュー (過去 30 日間)
Seba.V
Seba.V 2020 年 5 月 25 日
回答済み: Srivardhan Gadila 2020 年 5 月 28 日
Hi there!
I am trying to find a way to graph multiple plots in one figure by canging the parameters using a for loop.
My approach does not seem to be very successful..
Any suggestions on how I could do this?
Many thanks!
FX=0.1:0.001:10;
Q1=[0.2 0.3 0.5 0.7 1 5 8 10]
for i=1:8
Q(i)=Q1(i)
K1=(FX.^2.*(m1-1))./((m1.*FX.^2-1).^2+FX.^2.*(FX.^2-1).^2.*(m1-1).^2.*Q(i)^2).^0.5;
end
plot(FX,K1(1),FX,K1(2),FX,K1(3),FX,K1(4)....)
  1 件のコメント
Saloni Walia
Saloni Walia 2020 年 5 月 25 日
Hi! Try adding the plot command inside the body of the for loop and in the next line use the "hold on" command. It shall help:)

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

回答 (1 件)

Srivardhan Gadila
Srivardhan Gadila 2020 年 5 月 28 日
Refer to the documentation of hold and use it as follows:
for i=1:8
%
% Your code goes here
%
plot(FX,K1(i))
hold on
end

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by