problem with ode45 solving

1 次查看(过去 30 天)
Hello, I'm trying to solve the following system of differential equations but I'm not getting the right answer
ode1 = diff(x) == v;
ode2 = diff(v) == u;
t_interval = [0,10]
x0 = 0
v0 = 0
u = 1
because of how things are set up I can wrap my head on creating the function. Any help would be appreciate it.

采纳的回答

Star Strider
Star Strider 2021-4-28
Assuming both functions are functions of time —
syms x(t) v(t)
u = sym(1);
ode1 = diff(x) == v
ode1(t) = 
ode2 = diff(v) == u
ode2(t) = 
[x(t),v(t)] = dsolve(ode1,ode2, x(0)==0, v(0)==0)
x(t) = 
t
v(t) = 
figure
fplot(x, [0 10])
hold on
fplot(v, [0 1])
hold off
grid
xlabel('t')
legend('x(t)','v(t)')
.
  20 个评论
Juan Hurtado
Juan Hurtado 2021-5-3
Perfect! Well I that solves all my doubts. I reall appreciate all your help.
Thank you so much!

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by