vectors must be the same length ode45 plotting functions

We're trying to plot two functions on a figure from a diff equation ode45, the first one is f(t)=o, and the other one is h(o)=S.
the first one is showing on the figure but the second one is apparently wrong. how am I supposed to plot (o,S)???
every term is defined before the plot codes and under the ode45.
hold on
plot(t,o) (a graph is showen to this one)
plot(o,S) (how am I supposed to plot this ?)
error message every time we run:
(Error using plot
Vectors must be the same length.)

9 件のコメント

Torsten
Torsten 2019 年 3 月 5 日
Did you check whether o and S have the same length ?
Noella Makhlouta
Noella Makhlouta 2019 年 3 月 5 日
how do we check if they have the same length ? for they have differnet dimensions.
S is supposed to be a force, and the diff equation is o(2,1).
madhan ravi
madhan ravi 2019 年 3 月 5 日
Man just upload your code.
Torsten
Torsten 2019 年 3 月 6 日
Before the plot command, write
size(o)
size(S)
in your code.
What do you get ?
Noella Makhlouta
Noella Makhlouta 2019 年 3 月 6 日
I'm getting this
ans = 7837 2
ans = 1 1
I can't paste the code due to plagiarism.
KSSV
KSSV 2019 年 3 月 6 日
YOu cannot plot that.....MAy be you are looking for
plot(t,o)
madhan ravi
madhan ravi 2019 年 3 月 6 日
編集済み: madhan ravi 2019 年 3 月 6 日
plot(o,S*ones(size(o)))
[comment moved to answer section]
Noella Makhlouta
Noella Makhlouta 2019 年 3 月 6 日
I got now two sine waves which blong to plot(t,o) and a straight line. The question is to plot S as a function of o.
Noella Makhlouta
Noella Makhlouta 2019 年 3 月 6 日
thank you so much, you saved my life. <<<<3

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by