MATLAB: How to plot the phase portrait of a second-order differential equation? I cannot use quiver

MATLABphase portraitsecond order differential equation

?̈+ ?̇ − ? − ? 2 = 0
b. ?̈+ 4?̇ + 4? = 0
c. ?̈− 2?̇ + 2? = −8
d. ?̈− 2? − ?̇ − 2 = 0
I need to plot the phase portrait of these systems. What is wrong?
syms t
syms x(t)
dx=diff(x);
d2x=diff(x,2);
eq=d2x+dx-x-x.^2==0;
t=linspace(-1,1,100);
for n=1:5
s1=dsolve(eq,x(0)==n,dx(0)==n);
s2=diff(s1);
s1=subs(s1);
s2=subs(s2);
plot(s1,s2);
hold on
n=n+1;
end

Best Answer

Check the answer on similar question answered here