I want to solve this second order differential equation with MATLAB , but i cannot do it. Could u do it and help me please ?

Antworten (1)

Star Strider
Star Strider am 21 Dez. 2020

0 Stimmen

Use the Symbolic Math Toolbox.
Start by defining:
syms x(t)
Dx = diff(x);
Dx2 = diff(x,2);
I leave the rest to you.

4 Kommentare

Timur Camliova
Timur Camliova am 21 Dez. 2020
that's cool but i did not understand what should i do ?
Star Strider
Star Strider am 21 Dez. 2020
This appears to be a homework assignment, and our policy here is to only give hints for homework assignments, not full code.
You need to use the hints I provided to code your differential equation, then use dsolve to solve it. The simplify function will also help (use the 'Steps' name-value pair to be sure it is appropriately simplified).
Timur Camliova
Timur Camliova am 21 Dez. 2020
Actually it is not a homework assignment , i have done it with my hand but it is too hard and i want to solve it with using MATLAB for te other questions .
Since it is not homework, here is the full code, complete with a fplot call so you can see the output:
syms x(t)
Dx = diff(x);
Dx2 = diff(x,2);
Eqn = Dx2 +6 + 18*x == exp(-t);
ics = [x(0)==0, Dx(0)==0];
xsln = simplify(dsolve(Eqn, ics), 'Steps',500);
ltxeqn = latex(xsln);
figure
fplot(xsln, [0 6*pi])
grid
xlabel('t')
ylabel('x(t)')
title(['$x(t) =' ltxeqn '$'], 'Interpreter','latex')
.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 21 Dez. 2020

Kommentiert:

am 21 Dez. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by