I’m working on solving a system of coupled non linear differential equations

4 views (last 30 days)
- I've tried this code :
main()
function main
% Dfinition des constantes
Aap = 1; % Exemple de valeur, adapter
omega = 2 * pi; % Exemple de frquence angulaire
beta = 1; % Exemple de valeur
map = 1; % Exemple de valeur
c = 1; % Exemple de valeur
ff3 = 3; % Exemple de valeur
a = 0.04;
% Conditions initiales (y(1) y(8))
y0 = [0; 0; 2; 80; 10; 1; 75; 10];
% Intervalle de temps pour la simulation
tspan = [0, 10]; % Exemple : simulation entre t=0 et t=10 secondes
% Resolution du systeme d'equations differentielles
[t, y] = ode45(@(t, y) f(t, y, Aap, omega, beta, map, c, ff3, a), tspan, y0);
% Affichage des rsultats
plot(t, y);
xlabel('Temps');
ylabel('Valeurs des variables');
legend('y1', 'y2', 'y3', 'y4', 'y5', 'y6', 'y7', 'y8');
title('Rsolution du systme');
end
function dydt = f(t, y, Aap, omega, beta, map, c, ff3, a)
% Calcul de Q4 explicitement
Q4 = y(4) * Aap * (y(2) - a * omega * cos(omega * t));
% Calcul de Q3 explicitement
Q3 = y(7) * Aap * (y(2) - a * omega * cos(omega * t));
% quations diffrentielles
dydt = zeros(8, 1); % Initialisation du vecteur driv
dydt(1) = y(2); % quation (1)
dydt(2) = (1/map) * ((y(3) - y(6)) * Aap - c * y(1) - a * sin(omega * t) - ff3); % quation (2)
dydt(3) = (beta/y(5)) * ((Q4/y(4)) - Aap * (y(2) - a * omega * cos(omega * t))); % quation (3)
dydt(4) = (1/beta) * y(4) * dydt(3); % quation (4)
dydt(5) = Aap * (y(2) - a * omega * cos(omega * t)); % quation (5)
dydt(6) = (beta/y(8)) * ((Q3/y(7)) + Aap * (y(2) - a * omega * cos(omega * t))); % quation (6)
dydt(7) = (1/beta) * y(7) * dydt(6); % quation (7)
dydt(8) = -Aap * (y(2) - a * omega * cos(omega * t)); % quation (8)
end
  1 Comment
Torsten
Torsten on 12 Mar 2025
Edited: Torsten on 12 Mar 2025
The code gives results (although I cannot recover equations (1)-(10) ). So what is your question ? And what does dp3/dp3 and dp4/dp4 mean ?

Sign in to comment.

Answers (0)

Categories

Find more on Atomic, Molecular & Optical in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!