Please help me solve this differential equation
Afficher commentaires plus anciens
please i will like to solve this eqution for w=188 rad/s Please take a2=3 a3=2, b2=5 and b3=2
3 commentaires
Solve for x_double_dot, then substitute x = y1, x_dot = y2 and write your equation as a system of two first-order differential equations:
y1' = y2
y2' = x_double_dot = ...
Finally, use ODE45 to solve.
John D'Errico
le 18 Juil 2022
You tell us what the value of w is, but not all of the other important parameters. They are just as important. Thus what are a2, a3, b2 b3? If you don't have them, then no numerical solution will be possible. My expectation is no analytical solution will exist in any case, so a numerical solution is your only option.
Armel Kapso
le 19 Juil 2022
Réponse acceptée
Plus de réponses (1)
opts = odeset('RelTol', 1e-2, 'AbsTol', 1e-4);
[t, x] = ode45(@diffeqn, [0 1], [0.1; .1], opts);
whos
plot(t, x(:,2))
function dxdt = diffeqn(t, x)
a2=3; a3=2; b2=5; b3=2; w=188;
% Check this out
dxdt(1, 1) = x(2);
dxdt(2, 1) = ( (2*a3*w^3*sin(x(2)-w*t))*x(1) + ...
(2*a3*w*sin(x(2)-w*t))*x(1).^3 + ...
(-b2*sin(w*t) - b3*sin(x(2))) ) ./ ...
( 2*a2 -2*a3*w*(2*x(1)+w)*cos(x(2)-w*t) );
end
6 commentaires
Armel Kapso
le 19 Juil 2022
Armel Kapso
le 19 Juil 2022
Chunru
le 19 Juil 2022
Can you show what is the problem in 2018b, such as error message?
Chunru
le 19 Juil 2022
I did a correction in the code above.
Armel Kapso
le 19 Juil 2022
Chunru
le 19 Juil 2022
You need to save the code in a file, e.g., testdiff.m. Then run the program testdiff.m
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




