Borrar filtros
Borrar filtros

how can i Solve this equation With ode45

1 visualización (últimos 30 días)
adem ski
adem ski el 15 de En. de 2020
Respondida: Star Strider el 15 de En. de 2020
(d2y/dt^2)+w=0
how can i Solve this equation With ode45, w=1 and intrevall [0 10] and
y(1)=2
y(2)=0

Respuestas (1)

Star Strider
Star Strider el 15 de En. de 2020
Try this:
syms y(t) w T Y
DE = diff(y,2) + w;
[VF,Subs] = odeToVectorField(DE)
ODEfcn = matlabFunction(VF, 'Vars',{T,Y,w})
w = 1;
tspan = [0 10];
ic = [2 0];
[t,y] = ode45(@(t,y)ODEfcn(t,y,w), tspan, ic);
figure
plot(t,y)
grid
legend(string(Subs))
I assume the ‘y(1)’ and ‘y(2)’ references are to the initial conditions. If they are boundary conditions, a different approach is required.

Categorías

Más información sobre Ordinary Differential Equations 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