Info

此问题已关闭。 请重新打开它进行编辑或回答。

Tracking a square wave with an analytical function

2 次查看(过去 30 天)
A
A 2011-6-24
关闭: Sabin 2023-2-6
I have created a square wave (voltage schedule) in Excel, that I want to "track" with an analytical function.
The idea is to simulate a DC motor that has step changes in voltage.
R = 2;
L = 1e-3;
Ca = 1e-5;
% Continuous time voltage sched
Volt_vec = xlsread('voltage schedule.xlsx','C:C');
% Initial current
I_L_0 = 0;
% Initial voltage
V_C_0 = 0;
V_In = Volt_vec;
t = 0:.0001:.01;
alpha = R/2/L;
omega_0=sqrt(1/L/Ca);
zeta=alpha/omega_0;
omega_d=omega_0*sqrt(1-zeta^2);
A=[1, 0;
-alpha, omega_d]; %
b=[V_C_0-V_In;
I_L_0/Ca];
x=A\b;
V = exp(-alpha*t).*(x(1)*cos(omega_d*t)+x(2)*sin(omega_d*t))+V_In;
The voltage vector is similar to:
t = 0 to .001, V = 85
t = .001 to .004, V = 30
t = .004 to .01, V = 65 etc.
Just a square wave with varying lengths of the step.
Right now I just read in the voltage vector and use it as the step input (V_In), and it doesn't work due to matrix dimensions issues.
I need the final value (t,v) before the next step jump in voltage to serve as the initial conditions for the following case.

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by