I am not able to solve equilibria for coupled non linear ode system

2 visualizzazioni (ultimi 30 giorni)
Can any one help me how to incorporate ode45 into my code . I was using maple. Now My system does not have maple any more but only matlab.
I am trying to follow manual, not working . Define ode 1 , define ode 2 .
define odes[ode1, ode2] and use dsolve(odes) , not working
  1 Commento
John D'Errico
John D'Errico il 5 Apr 2023
You CANNOT use ODE45 on symbolic problems or where you have symbolic parameters, so parameters where the values are unknown.
As far as what is not working, unless you show what you ]did, then how can anyone help you? We cannot read yor mind or see into your computer.
(Did you not ask this same question just recently? Or is this for a class, where your friends are asking the same questions?)

Accedi per commentare.

Risposte (1)

Sam Chak
Sam Chak il 5 Apr 2023
Modificato: Sam Chak il 5 Apr 2023
@Ruma Dutta, can you fit your ODE in this example (double integrator)? If there are more states, then duplicate the lines as necessary. This is how you learn by example.
% Define the input signal
u = @(y) - y(1) - 2*y(2);
% Define the ODE
odefcn = @(t, y) [y(2); % y1' = y2
u(y)]; % y2' = u
% Define the time interval for simulation
tspan = [0 20];
% Define the initial conditions (ic)
x0 = 1; % initial position
v0 = 0; % initial velocity
y0 = [x0; v0]; % a vector of ic
% Solve the system using the ode45 solver
[t, y] = ode45(odefcn, tspan, y0);
% Extract the position and velocity from the solution
x = y(:, 1);
v = y(:, 2);
% Plot the position and velocity over time
subplot(2, 1, 1);
plot(t, x); grid on
ylabel('Position');
subplot(2, 1, 2);
plot(t, v); grid on
ylabel('Velocity');
xlabel('Time');

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by