MATLAB: ODE symbolic result plotting with fplot()

MATLABodeSymbolic Math Toolbox

Hello,
So I am trying to solve an ODE using the symbolic toolbox.
syms phi(t) g l d m
dphi = diff(phi,t); % Derivative of phi(t)
phi(t) = dsolve(diff(phi,t,t)== -g/l*phi-d/(m*l^2)*diff(phi,t),... % ODE (governing the movement of a pendulum)
phi(0) ==1,... % Initial condition 1
dphi(0)==0) % Initial condition 2
phi(t) = subs(phi(t),{l,m,g,d},{10,5,9.81,50}) % Replacing with known values
fplot(phi,[1 100]) % symbolic plotting between 1 and 100 s
I get the expected result but when I plot it, I get numerous vertical lines that add noise to my plot and it is almost unreadable. I am using Matlab on a Mac. How do i get rid of those lines ?

Best Answer

I am not certain what the problem is with the original function.
If you simplify it first:
phi = vpa(simplify(phi, 'Steps',500),5)
the vertical lines (indicating infinite results) disappear. (I use vpa here to shorten the output so I can see all of it. It is not necessary for the code.)