Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

non linear differential equation

Asked by mohan on 30 Nov 2012

please help me how to solve

 dq/dt + q =  a1 + b1*u(t) + 1/u(t)^2 

0 Comments

mohan

Products

1 Answer

Answer by Azzi Abdelmalek on 30 Nov 2012
Edited by Azzi Abdelmalek on 30 Nov 2012
function dq=myeq(t,q,t1,u1,a1,b1)
u=interp1(t1,u1,t)
dq=-q+a1+b1+1/u^2;

%Then call myeq

a1=1;
b1=2;
q0=0;
t1=1:0.1:10;  % vector time
u1=t1.^2      % your vector u
[t q]=ode45(@(t,q) myeq(t,q,t1,u1,a1,b1),t1,q0)
plot(t,q)

0 Comments

Azzi Abdelmalek

Contact us