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
2019년 3월 5일
Did you check whether o and S have the same length ?
Noella Makhlouta
2019년 3월 5일
madhan ravi
2019년 3월 5일
Man just upload your code.
Torsten
2019년 3월 6일
Before the plot command, write
size(o)
size(S)
in your code.
What do you get ?
Noella Makhlouta
2019년 3월 6일
KSSV
2019년 3월 6일
YOu cannot plot that.....MAy be you are looking for
plot(t,o)
madhan ravi
2019년 3월 6일
편집: madhan ravi
2019년 3월 6일
plot(o,S*ones(size(o)))
[comment moved to answer section]
Noella Makhlouta
2019년 3월 6일
Noella Makhlouta
2019년 3월 6일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!