Borrar filtros
Borrar filtros

Use MATLAB Editor to create a Linearizing Program

2 visualizaciones (últimos 30 días)
Jack Glendenning
Jack Glendenning el 4 de Mayo de 2016
Comentada: Bhavesh el 11 de Mayo de 2016
Have to Linearize the following ODE using MATLAB Editor:
13y''+0.27y'-0.35/y +3.5=1.2753
y(0)=0
y'(0)=0 for 0<= t <=5

Respuesta aceptada

Bhavesh
Bhavesh el 9 de Mayo de 2016
Editada: Bhavesh el 9 de Mayo de 2016
For a 2nd order differential equation of the form - y'' + p(t) y' + q(t)y = g(t) with initial conditions - y(to) = yo and y'(to) = y1
We assign x1 = y; x2 = y0
Step 1) First convert 2nd order equation to an equivalent system of 1st order equations.
  • Let x1 = y and x2 = y'
Thus,
  • x1' = x2
  • x2' = -q(t)x1 - p(t)x2 + g(t)
Step 2) Create and save a .m file which will return a vector-valued function
function xp=eg1(t,x)
xp=zeros(2,1);
xp(1)=x(2);
xp(2)=(0.35/13)*x(1)-(0.27/13)*x(2)+(1.2753/13);
end
Step 3) Call the function by using the command -
[t,x]=ode45('eg1',[0,5],[0,0]);
  2 comentarios
Jack Glendenning
Jack Glendenning el 11 de Mayo de 2016
I finally understand now. Thank-you very much Bhavesh! That was very helpful.
Bhavesh
Bhavesh el 11 de Mayo de 2016
It was my pleasure to help you and I am glad that the workaround resolved the issue.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Function Creation en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by