MATLAB: Writing differential equation for plot second order differential equation Can anyone help me how to write differential below equation for plot d2x/dt2 = -sign(x + dx/dt) I tried in below way and it is failing ode = diff(x,t,2) == -sign(x + diff(x,t)); Best Answer Try thissyms x(t)d1x = diff(x);d2x = diff(x,2);ode = d2x == -sign(x + d1x);cond = [x(0)==1 d1x(0)==0]sol = dsolve(ode, cond)This requires the Symbolic Math toolbox. Related SolutionsMATLAB: I can’t plot 2nd order differential equation I can!Try this:syms x(t);Dx = diff(x);Dx2 = diff(x,2);x(t) = dsolve(Dx2+(5*Dx)+(6*x)==100,x(0)==0,Dx(0)==0)figure(1)fplot(x, [0 10])axis([xlim 0 17])grid MATLAB: Error when plotting a graph Use fplot if you have R2016a or later, ezplot otherwise. Related QuestionDraw othorgonal trajectories using differential equationsODE solver: Undefined function or variable ‘y’Is the fimplicit plot empty
Best Answer