필터 지우기
필터 지우기

How to apply Heaviside function over external force?

조회 수: 1 (최근 30일)
Alireza Babaei
Alireza Babaei 2022년 8월 31일
답변: Walter Roberson 2022년 8월 31일
Dear all,
Suppose we have a harmonic external force in time-domain, and I need to apply this force for only 5 seconds and then get the system response for 100 seconds.
System is defied with all dynamic properties like mass, stuffness and damping ...,
  • there is easier way to handle it via Simulink, but we need to script the code in time-domain.
The code we have, applies the external force during the entire time interval which is not our interest. We want to apply the excitation only for a short time interval like 3-5 seconds but not more.
Any ideas?
m = 1; % mass
c1 = 0.5; % damping
k = 1; % stiffness
ccr = 2*sqrt(m*k); % critical damping
zeta1 = c1/ccr; % damping ratio
w = sqrt(k/m); % w stands for natural frequency
%% Bode plot and TF generation
mytf1 = tf([0,01],[1,2*zeta1*w,w^2]) % creating the T.F.
% time-domain
v0 = 0.5; %I.C. in velocity in m/s
y0 = 0.05; % I.C. initial displacement in meteres
t = linspace(0 , 100 , 1000);
wd = w*sqrt(1 - zeta1^2); % damped frequency
yh = exp(-zeta1.*w.*t).*(y0.*cos(wd.*t)+((v0+zeta1.*w.*y0)/wd).*sin(wd.*t));
% define the Harmonic Excitation
we = 0.25
% frequency of the system - Resonance
F0 = 0.1; % F0 is the amplitude of the harmonic excitations in meters
F = F0.*exp(1j.*we.*t);
yp = (F0 ./ (w^2 - we^2 + 2*zeta1*w*we)) .* exp(1j.*we.*t);
y = yh + yp;
figure(2)
plot(t , y , 'b');
hold on
plot(t , yp , 'r');
hold on
plot(t , yh , 'k');
hold off
% set(gca , 'FontSize' , 12)
legend({'both transient and steady-state' , 'steady-state' , 'transient'} , 'FontSize' , 12)
grid on
figure(3)
plot(t , yp)
figure(4)
plot(t , y)

채택된 답변

Walter Roberson
Walter Roberson 2022년 8월 31일
The laplace of a rectangular pulse can be written like s*(1-exp(-s*h)) where h is the width of the pulse. This can be written s=tf('s') and then the above expression with numeric h value, getting a ss model as a result. Multiply by your tf to get a windowed version of the model.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by