How to solve this

6 vues (au cours des 30 derniers jours)
Minh Danl
Minh Danl le 30 Oct 2020
Commenté : Ameer Hamza le 30 Oct 2020
  2 commentaires
KSSV
KSSV le 30 Oct 2020
Substitute second equation into first and use ode45.
Minh Danl
Minh Danl le 30 Oct 2020
Can i use dsolve for this math

Connectez-vous pour commenter.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 30 Oct 2020
Modifié(e) : Ameer Hamza le 30 Oct 2020
Following shows how to find a numerical solution. You ODEs seems stiff, therefore, I used a stiff solver (ode23s).
tspan = [0 10];
IC = [0; 0; 0];
[t, y] = ode23s(@odeFun, tspan, IC);
plot(t, y);
legend({'$\theta$', '$\dot{\theta}$', '$i(t)$'}, ...
'FontSize', 16, 'Interpreter', 'latex', 'Location', 'best')
function dXdt = odeFun(t, X)
J = 1;
Kt = 0.1;
b = 0.5;
L = 1e-2;
R = 10;
V = 1;
Ke = 0.5;
% X is 3x1 vector
% X(1) is theta, X(2) is theta_dot, X(3) = I
theta = X(1);
theta_dot = X(2);
i = X(3);
dXdt = zeros(3,1);
dXdt(1) = X(2);
dXdt(2) = 1/J*(Kt*i-b*theta_dot);
dXdt(3) = 1/L*(-R*i+V-Ke*theta_dot);
end
  6 commentaires
Minh Danl
Minh Danl le 30 Oct 2020
i'm using matlab 2014a
Ameer Hamza
Ameer Hamza le 30 Oct 2020
In that case create a new file named odeFun.m in current MATLAB folder and paste the following code in it
function dXdt = odeFun(t, X)
J = 1;
Kt = 0.1;
b = 0.5;
L = 1e-2;
R = 10;
V = 1;
Ke = 0.5;
% X is 3x1 vector
% X(1) is theta, X(2) is theta_dot, X(3) = I
theta = X(1);
theta_dot = X(2);
i = X(3);
dXdt = zeros(3,1);
dXdt(1) = X(2);
dXdt(2) = 1/J*(Kt*i-b*theta_dot);
dXdt(3) = 1/L*(-R*i+V-Ke*theta_dot);
end

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by