- #1
marellasunny
- 255
- 3
My book explains the command x(:,1) as "x,all rows,first column".
Q.How does the output of ode45 for a system of differential equations look like?
But,when I solve a system of 2 first order differential equations(w.r.t time),I take x as a "column vector".
[x1
x2]
So,if I wanted to plot x(1) which is the first row of the column vector,I should write plot(t,x(1)) right? MATLAB gives an error.
MATLAB however accepts this ''plot(t,x(:,1))'',which literally means plotting all rows,1st column x versus t.
I don't get it.x has only 1 column and 2 rows.Where is the question of 1st and 2nd column in x?
Q.How does the output of ode45 for a system of differential equations look like?
But,when I solve a system of 2 first order differential equations(w.r.t time),I take x as a "column vector".
[x1
x2]
So,if I wanted to plot x(1) which is the first row of the column vector,I should write plot(t,x(1)) right? MATLAB gives an error.
MATLAB however accepts this ''plot(t,x(:,1))'',which literally means plotting all rows,1st column x versus t.
I don't get it.x has only 1 column and 2 rows.Where is the question of 1st and 2nd column in x?
Last edited: