Matlalb problem with two first order ODEs

  • Thread starter sara_87
  • Start date
763
0

Main Question or Discussion Point

1. Homework Statement

I have two questions:
1) If i have two first order ODE y(1) and y(2) (in terms of time), i know how to plot y(1) versus time and y(2) versus time but i dont know how to plot y(2) versus y(1)

2)I have two second order ODES X''=... and Z''=... to solve this, we make the substitutions y(1)=X, y(2)=X', y(3)=Z, and y(4)=Z'
then we have two first order ODEs: y(2)'=... and y(4)'=...
I typed this into Matlab (dydt=[(the equation for y(2)'; the equation for y(4)']) but an error came up since i didnt define y(4). how do i do this?
2. Homework Equations



3. The Attempt at a Solution
1) i tried putting:
plot(y(1),y(:,2)), and i also tried plot(y(1),y(2)) but these didnt work.


Any help would be very much appreciated.
Than you.
 

Answers and Replies

1,860
0
1) plot(y(:,1),y(:,2)) ought to work, assuming you just left out the iterate through all rows part in the first column.

2) Can you post your exact system of equations function?
 

Related Threads for: Matlalb problem with two first order ODEs

  • Last Post
Replies
2
Views
831
Replies
3
Views
6K
Replies
7
Views
3K
Replies
1
Views
2K
Replies
0
Views
3K
Replies
2
Views
2K
Top