Numerical solution for a 2nd order ode
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi everyone, I'm struggling to find the numerical solution for the following equation and conditions:
y'' + (0.2)*y' - y - y^3 = (0.3)*cos(wt) y(0) = 0 y'(0) = 0
I need to plot a numerical solution from ti = 0 to tf = 100 for w = 0.8:0.1:1.5. I am really new to matlab so fair warning, here's what I've got so far:
syms y t;
a = y;
b = Dy;
Db = (0.3)*cos(w*t)-(0.2)*b + a - a^3;
figure;
hold on
for x = 0.8:0.1:1.5
ezplot(subs(Db, 'w', x), [0 100])
end
hold off
axis ([0 100 0 3])
title 'Numerical solutions of D2y + (0.2).*Dy - y - y.^3 = (0.3).*cos(w.*t) when w = 0.8, 0.9,..., 1.4, 1.5'
legend('w = 0.8', 'w = 0.9', 'w = 1.0', 'w = 1.1', 'w = 1.2', 'w = 1.3', 'w = 1.4', 'w = 1.5')
I'd appreciate any guidance or feedback, thank you!
1 comentario
Jan
el 31 de Mzo. de 2017
"Numerical" solution means, that you do not use "syms".
Start with converting the 2nd order equation to a system of equations of the 1st order.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!