Increase amplitude for an individual plot in a hold on multiplot

1 次查看(过去 30 天)
Good morning, I have the following code:
VAR= rand(2000,4);
sepa=5;
for i=1:4
plot(VAR(:,i)+sepa*(i-1))
hold on
end
Which give me the following results. Now I would like to increase the amplitude (ylim) of one single signal of my plot.
How I should do this?
Thank you!
Figure.jpg

回答(1 个)

Areej Varamban Kallan
Hi Georgina,
In my understanding, you want to multiply the y-values of a particular plot by a constant factor so that the entire plot scales up. This can be achieved by getting the handle to the required plot and changing the property YData. For example, if you need to double the amplitude of the second plot, you can try the following:
VAR= rand(2000,4);
sepa=5;
for i=1:4
p(i) = plot(VAR(:,i)+sepa*(i-1));
hold on
end
p(2).YData = 2*p(2).YData;

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by