How can I generate a repetition of impulse response when I feed the system with repetition of pulses?

4 次查看(过去 30 天)
I have the transfer function for a system and I want to generate a repetition of pulses as the input to the system and output the impulse response of the input pulses. The impulse response should be a repetition of the system impulse response.

采纳的回答

MathWorks Support Team
We can use the Control System Toolbox to do this. 
The following code generates the system from the transfer function using 'tf' function
close all, clear all, clc
t=[0:.2e-3:1]; % Time vector
C=1e-2; L=20e-4; R=80e-3; % System parameters
a=1; b=[L*C R*C 1]; % Denominators and numerators
sys=tf([a],[b]) % Transfer function
impulse(sys) % Just a single pulse
Then we can generate the repetition of pulses and invoke the system impulse response using 'lsim' function.
% Generate input pulses
dt = 0.0002; %Sample rate
tend = 2.5; %Simulation period
t = 0:dt:tend;
period = 0.5; %Period of the input pulses
u = zeros(length(t),1);
for i=1:length(t)
if rem(t(i),0.5)==0
u(i)=1;
end
end
% Invoke the system response
% sysd = c2d(sys,dt); % Continuous to discrete system conversion.
[y yt] = lsim(sys,u,t);
y = y/dt; % Normalize with sample time.
% Plot the input and the output.
subplot(2,1,1);
plot(t,u);
title('Input');
subplot(2,1,2);
plot(yt,y);
title('Impulse Responce');
 
 

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Control System Toolbox 的更多信息

标签

尚未输入任何标签。

产品


版本

R2009b

Community Treasure Hunt

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

Start Hunting!

Translated by