ode45 or dsolve
Mostrar comentarios más antiguos
whats wrong with my code.. its from a book but cant run
tspan=[0 4];
y0=[0.02;0];
[t,y]=ode45('unforced1',tspan,y0);
plot(t,y(:,1));
grid on
xlabel(‘time’)
ylabel(‘Displacement’)
title(‘Displacement Vs Time’)
hold on;
its function is function yp = unforced1(t,y)
yp = [y(2);(-((c/m)*y(2))-((k/m)*y(1)))];
4 comentarios
Torsten
el 24 de Jun. de 2019
You must give numerical values to k,c an m if you use ode45.
felik kamwera
el 24 de Jun. de 2019
Chinmay Anand
el 24 de Jun. de 2019
What are c and m defined in your function ? Have you assigned any values to them ?
felik kamwera
el 24 de Jun. de 2019
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!