How do you plot nonlinear differential equations?

Dx=y
Dy=-k*y-x^3+9.8*cos(t)
inits=('x(0)=0,y(0)=0')
these are the differential equations that I wanted to plot.
first, I tried to solve the differential equation and then plot the graph.
Dsolve('Dx=y','Dy=-k*y-x^3+9.8*cos(t)', inits)
like this, however, there matlab is telling me that it has no explicit solution for this system.
now i am stuck :(
how can you plot this system without solving the equations?

2 件のコメント

Peter
Peter 2013 年 4 月 16 日
by others help,
k = 1;
f = @(t,x) [x(2); -k * x(2) - x(1)^3 + 9.8 * cos(t)];
tspan = [0, 10];
xinit = [0, 0];
ode45(f, tspan, xinit)
If I do this I get a graph of x(1)vs t/x(2)vs t seperately, however the graph I wanted was x(2)vs x(1).
Can anyone help me with this?
Yao Li
Yao Li 2013 年 4 月 16 日
Do Dx and Dy equal to dx/dt and dy/dt or just dx and dy?

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeOptimization についてさらに検索

製品

質問済み:

2013 年 4 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by