필터 지우기
필터 지우기

how can i write the RLC equations? (image)

조회 수: 3 (최근 30일)
LG
LG 2022년 6월 16일
답변: Sam Chak 2022년 6월 16일
% Método de RK4Orden ---------------------------------------
% x-Vector de tiempo
% y1,y2-Vectores de carga y corriente
% li-Limite inferior en el tiempo
% ls-Limite superior superior en el tiempo
% h-Paso
clear
% Parámetros del circuito -----------------------------------------
R=2;
L=3;
C=1;
Et=8;
% Ecuaciones Diferenciales Ordinarias dy/dx=f(x,y) a resolver --------------
f1=@(x,y1,y2) ;
f2=@(x,y1,y2) ;
% Condiciones iniciales -----------------------------------------------
x(1)=;
y1(1)=;
y2(1)=;
li=0
ls=5
h=0.5
% Método de RK4Orden ---------------------------------------------------
while x(end)<=xn
k11= f1(x(end),y1(end));
k21= f1(x(end)+.5*h,y1(end)+.5*h*k11);
k31= f1(x(end)+.5*h,y1(end)+.5*k21*h);
k41= f1(x(end)+h,y1(end)+k13*h);
x(end+1)=x(end)+h;
y1(end+1)=y1(end)+1/6*(k11+2*k21+2*k31+k41)*h;
end
while x(end)<=xn
k12= f2(x(end),y2(end));
k22= f2(x(end)+.5*h,y2(end)+.5*h*k12);
k32= f2(x(end)+.5*h,y2(end)+.5*k22*h);
k42= f2(x(end)+h,y2(end)+k32*h);
x(end+1)=x(end)+h;
y2(end+1)=y2(end)+1/6*(k12+2*k22+2*k32+k42)*h;
end
hold on
plot(x,y1,x,y2)
fprintf("TABLA-MÉTODO RK4ORDEN")
[x' y1' y2']

답변 (1개)

Sam Chak
Sam Chak 2022년 6월 16일
You can get the required RLC equations using odeToVectorField function. However, for education purposes, please follow along.
Given the RLC system as follows
First, divide the equation by L to make the coefficient of the highest order term (), becomes 1.
Then, move all terms on the left-hand side except for the highest order term, to the right-hand side.
Note that the RHS has 3 variables with two are the system states {} and one is the system input {}.
If we let , , and , then the 2nd-order RLC system can be rewritten as a system of 1st-order ODEs:
This model representation of the dynamics is called the state-space model, having the form
I haven't run you code, but in MATLAB code, you can write something like this:
f1 = @(x,y1,y2) y2;
f2 = @(x,y1,y2) - (1/(L*C))*y1 - (R/L)*y2 + (1/L)*Et;

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by