MATLAB: How to plot different length vectors

differentMATLABmultipleplotsize;

Hi,
I need to plot different orbits in one figure.
The coordinate vectors are result of a Runge-Kutta 7-8 so I can't know if the number of elements from each orbit coordinates are the same (maybe one has 2000 points and another 2500 or so.
When I try to plot them all together, the result is that I get only the last figure.
My code is:
C=C1;
[ resu1 ] = nInt( fun , ab , tspan, titol, rotulacio,C );
C=C2;
[ resu2 ] = nInt( fun , ab , tspan, titol, rotulacio,C );
C=C3;
[ resu3 ] = nInt( fun , ab , tspan, titol, rotulacio,C );
rD1=resu1(2,:)./d;
rpD1=resu1(4,:)./d;
rD2=resu2(2,:)./d;
rpD2=resu2(4,:)./d;
rD3=resu3(2,:)./d;
rpD3=resu3(4,:)./d;
plot (rD1,rpD1,rD2,rpD2,rD3,rpD3)
title('rp/d vs r/d');
xlabel('r/d');
ylabel('rp/d');
I just get rD3 vs rpD3. Where is my mistake?
Thanks.

Best Answer

When you plot() multiple pairs of values and your plot appears to have only a single output, then one possibility is that your lines are all the same to within drawing scale, that the lines are right on top of each other to within the resolution of the screen.
Sometimes zooming in can show the differences between the lines. Sometimes using different markers for the lines can help show that they are all there. Sometimes using different line styles can help (e.g., a solid line would be visible in the gaps of a dashed line)
For testing purposes, try
subplot(1,3,1)
plot(rD1,rpD1)
subplot(1,3,2)
plot(rD2,rpD2)
subplot(1,3,3)
plot(rD3,rpD3)
if all three lines appear and have the same shape then they would have been on top of each other with the single plot() call.