0
votes

Let

 x=[1 2 3 4 5 6 7 8 9 10 11 12];
 t=[0 1 2 3 4 5 6 7 8 9 10 11];

Then

plot(t, x);

will produce a straight line as shown below: enter image description here

Now suppose I am not given x and t instead x and t being decomposed into 4 different sections:

x1=[1 2 3];
x2=[4 5 6];
x3=[7 8 9];
x4=[10 11 12];

t1=[0 1 2];
t2=[3 4 5];
t3=[6 7 8];
t4=[9 10 11];

I have to plot x1, x2, x3 and x4 such that I again get the same plot as above. What do I do ?

If I try this :

plot(t1,x1, t2,x2,  t3,x3, t4,x4 )

Then I am NOT getting as expected:

enter image description here

1

1 Answers

1
votes

You can concatenate the vectors and then plot them. Like this:

t=[t1 t2 t3 t4];
x=[x1 x2 x3 x4];

plot(t,x);