How exactly does one us the lsim function?
I added "step(Zo)" and "lsim(Zo, u, t)" below to compare results.
With step I see results that I am expecting though I cannot modify step rise/fall times.
I'm not seeing any results with lsim.
Used the first examplefrom the lsim page:
https://www.mathworks.com/help/control/ref/lsim.html
%% Closed Loop Zo(s) = Zout(s)/(1 + T(s))
% Zout(s) Transfer Function Setup
L1 = 1e-6; % inductance
C1 = 200e-6; % output filter capacitance
Rs = 30e-3; % series resistance RL + Ron
Resr = 0.8e-3; % capacitor equivalent series resistance
R = 1e3; % load resistance
%% Zout(s) transfer function salient features
woD = 1/(sqrt(L1*C1));
QoD = 1/( woD*((Rs+Resr)*C1 + (L1/R)));
Z0 = Rs; % Zout(s) DC gain
woN = 1/(sqrt((Resr/Rs)*L1*C1));
QoN = 1/(woN*(Resr*C1 + (L1/Rs)));
w1N = QoN*woN;
w2N = woN/QoN;
%% Open-loop output impedance transfer function
s = tf('s');
Zout = Z0*( ((1 + s/w1N)*(1 + s/w2N))/(1+(1/QoD)*(s/woD)+(s/woD)^2) );
%% Loop gain T
L1 = 1e-6; % inductance
Rs = 30e-3; % series resistance RL + Ron
C1 = 200e-6; % output filter capacitance
Resr = 0.8e-3; % capacitor equivalent series resistance
Vg = 5; % input voltage
R = 1e3; % load resistance
VM = 1; % PWM saw-tooth amplitude
Vref = 1.8; % reference voltage
H = 1; % sensing gain
%% Gvd transfer function salient features
wesr = 1/(C1*Resr); % esr zero
wo = 1/sqrt(C1*L1); % center frequency of the pair of poles
Qload = R/sqrt(L1/C1);
Qloss = sqrt(L1/C1)/(Resr+Rs);
Q = Qload*Qloss/(Qload+Qloss); % Q factor
%% Open-loop control-to-output transfer function
s = tf('s');
Gvd = Vg*(1+s/wesr)/(1+(1/Q)*(s/wo)+(s/wo)^2);
%% PID compensator (see lecture slides)
R2 = 16e+3; % Compensator
R1 = 3e+3; % Compensator
R4 = 360e+0; % Compensator
C2 = 1.3e-9; % Compensator
C4 = 1.5e-9; % Compensator
Gc0 = R2/R1;
wL = 1/(C2*R2);
wz = 1/(C4*R1);
wp1 = 1/(C4*R4);
fL = wL/(2*pi);
fz = wz/(2*pi);
fp1 = wp1/(2*pi);
wp2 = 2*pi*1e6; % Added to protect OP AMP Gain BW product
%% Open-loop Gc(s) transfer function
s = tf('s');
Gc = Gc0*(1+wL/s)*(1+s/wz)/(1+s/wp1);
T = minreal( H*(1/VM)*Gvd*Gc );
Zo = minreal( Zout/(1 + T) );
figure(1)
step(Zo)
figure(2)
[u,t] = gensig('square',4,10,0.1);
lsim(Zo, u, t)