Oct 25, 2008 #1 Fractional-N Full Member level 1 Joined Oct 15, 2007 Messages 97 Helped 2 Reputation 4 Reaction score 2 Trophy points 1,288 Activity points 2,071 how to solve differential equation by matlab i want to solve the above differential equation in matlab. i wrote this m-file: Code: function dv=diffv(t,vv) vv=[0;1]; v=vv(1); vdot=vv(2); l=1e-5; c=1e-6; vdot=vdot; vdoubledot=5/(l*c)-vdot/c*(3/10*(v-21/4)^2-2)-vdot/(l*c); dv=[vdot;vdoubledot]; [T,V]=ode15s(@diffv,[0 0.1],[0 0]); plot(T,V(:,1),'-') the above program return an error: ??? Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limit. Be aware that exceeding your available stack space can crash MATLAB and/or your computer. Error in ==> funfun\private\odearguments at 227 Click to expand... then i removed the 2 last line and type it in command window. the error is gone but the plot is a line. it must be a sinusoidal. Code: function dv=diffv(t,vv) vv=[0;1]; v=vv(1); vdot=vv(2); l=1e-5; c=1e-6; vdot=vdot; vdoubledot=5/(l*c)-vdot/c*(3/10*(v-21/4)^2-2)-vdot/(l*c); dv=[vdot;vdoubledot];
how to solve differential equation by matlab i want to solve the above differential equation in matlab. i wrote this m-file: Code: function dv=diffv(t,vv) vv=[0;1]; v=vv(1); vdot=vv(2); l=1e-5; c=1e-6; vdot=vdot; vdoubledot=5/(l*c)-vdot/c*(3/10*(v-21/4)^2-2)-vdot/(l*c); dv=[vdot;vdoubledot]; [T,V]=ode15s(@diffv,[0 0.1],[0 0]); plot(T,V(:,1),'-') the above program return an error: ??? Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limit. Be aware that exceeding your available stack space can crash MATLAB and/or your computer. Error in ==> funfun\private\odearguments at 227 Click to expand... then i removed the 2 last line and type it in command window. the error is gone but the plot is a line. it must be a sinusoidal. Code: function dv=diffv(t,vv) vv=[0;1]; v=vv(1); vdot=vv(2); l=1e-5; c=1e-6; vdot=vdot; vdoubledot=5/(l*c)-vdot/c*(3/10*(v-21/4)^2-2)-vdot/(l*c); dv=[vdot;vdoubledot];
Oct 26, 2008 #2 Fractional-N Full Member level 1 Joined Oct 15, 2007 Messages 97 Helped 2 Reputation 4 Reaction score 2 Trophy points 1,288 Activity points 2,071 anyone knows how to solve a differential equation with matlab?? i really need help