Clear Filters
Clear Filters

Increase amplitude for an individual plot in a hold on multiplot

1 view (last 30 days)
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

Answers (1)

Areej Varamban Kallan
Areej Varamban Kallan on 7 Feb 2019
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;

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!