Learning Subplots
In matlab this is done using the subplot
function.
Here is the reference.
Basically you first create a figure, then divide it into a 2-D grid using the first two arguments to subplot:
subplot(2, 2, 1);
for example would create a 2-by-2 grid -- thus creating space for 4 plots. The last index 1
selects the first plot of the grid, i.e. the plot in position (0, 0) starting from the top left corner of the figure area.
subplot(2, 2, 3);
Would instead select the third plot, i.e. the plot in position (1, 0) starting from the top left corner of the figure area.
A Working Example
A working example in your case would be
figure(1); % Create new figure #1
clf; % Clear the figure
% Compute the data
a=cpl(x,v,s,[4 1])
b=cpl(x1,v1,s1,[4 1])
% Plot it
subplot(2, 1, 1);
plot(a);
subplot(2, 1, 2);
plot(b);
Learning to Hold On
If, as others mentioned, you are instead trying to plot two curves on the same pair of axes, the hold function is what you need. Without the hold your second plot command would in fact overwrite the first plot.
A Working Example
A working example in your case would be
figure(1); % Create new figure #1
clf; % Clear the figure
% Compute the data
a=cpl(x,v,s,[4 1])
b=cpl(x1,v1,s1,[4 1])
% Plot it
plot(a);
hold on;
plot(b);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…