user3466199
user3466199

Reputation: 21

Plotting multiple graphs in a specific figure in matlab

so, I have a many figures and I want to select one of them and then plot into it another's graphs, how can I do that ?

thanks in advance

Upvotes: 0

Views: 888

Answers (1)

Omid
Omid

Reputation: 260

I would personally use subplot or figure and hold all in this situation.

Therefore, your code would look like:

clc;clear; a = [ 1.8 2.5 6.4 ] ; % acceleration 
t = 0:.01:15 ; n = 1 ; 
figure; 
while n < 4 
velocity = a(n)*t ; 
position = 0.5*a(n)*t.^2 + velocity.*t ; 
figure(1);plot(t,velocity);
hold all;
figure(2);plot(t,position);
n = n + 1 ; 
hold all;
end
hold off;

Upvotes: 1

Related Questions