Plotting phase space for 2nd order nonlinear ODE
Show older comments
Hello, I'm trying to figure out how to plot the phase space for a 2nd order nonlinear ODE.
Problem Statement
Given the 2nd order ODE, (d^2x/dt^2) - u*(1-x^2)*(dx/dt)+x=0, initial conditions are x(0) = 2 and x'(0) = 0. Find the solution if u = 1 and t is from 0-30 seconds. Plot time vs x and the phase space where x vs x'
MATLAB Code (what I have so far)
[t, y] = ode45(@ODE45SolvMain,[0 30],[2 0])
figure(1)
plot(t,y(:,1),t,y(:,2))
xlabel('Time t')
ylabel('Displacement')
title('Displacement vs Time')
legend('x_1','x_2')
---------------------------------------------------------
% Function Definition
function [x_primes] = ODE45SolvMain(t,x)
u = 1;
x_primes = [x(2); u*((1-x(1)^2))*x(2)-x(1)]
My solution so far

This figure is for the time vs x plot. I am unsure how to begin and plot the phase space for the this ODE.
Accepted Answer
More Answers (1)
Steven Lord
on 9 May 2022
0 votes
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
