Info
此问题已关闭。 请重新打开它进行编辑或回答。
How can I change the line color in a graph using plot?
1 次查看(过去 30 天)
显示 更早的评论
to plot this figure
clc;
clear all;
close all;
fs = 1000;
t = 0:1/fs:0.2;
Vm = 720; % Volt
f0 = 50 ;% Hz
q = 0.5 ; % Voltage Gain
alpha = 0;
Va = Vm*q*cos(2*pi*f0*t + alpha);
Vb = Vm*(q + 0.2*q*(t == 0.1)).*cos(2*pi*f0*t + alpha);
figure,
plot(t,Va,'r',t,Vb,'b');
xlabel('Time');
ylabel('Va and Vb');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/169746/image.png)
1 个评论
Walter Roberson
2017-11-17
Your code
plot(t,Va,'r',t,Vb,'b');
already sets the color of the Va plot to be red and of the Vb plot to be blue.
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!