More Related Content Similar to Convolution_System_Response (20) Convolution_System_Response1. %Matthew Mobley
%Mechanical Vibrations
%Convolution Integral, System Response, HW#14
%11/18/2014
%===============================DEFINITIONS================================
m = 1; c = 2.5; k = 100; wn = sqrt(k/m);
cc = 2*sqrt(m*k); zeta = c/cc; wd = wn*sqrt(1-(zeta)^2); t0 = 0.5;
w = pi/(2*t0);
numPoints = 100;
dt = t0/numPoints;
t_beforet0 = 0:dt:t0; t_beforet0 = t_beforet0(1:end-1);
x_beforet0 = zeros(1, numPoints);
t_aftert0 = t0:dt:6*t0; t_aftert0 = t_aftert0(1:end-1);
x_aftert0 = zeros(1, 5*numPoints);
t = [t_beforet0 t_aftert0];
%==========================================================================
%Forcing Function
x_stat = [t_beforet0/t0, 0*t_aftert0];
%Impulse Momentum Response
x_IM = ((wn^2)/(w*wd))*exp(-zeta*wn*t).*sin(wd*t);
%Convolution===============================================================
A = @(t, tau, zeta, wn, wd, w, t0) (tau/t0).*exp(zeta*wn*tau).*cos(wd*tau);
B = @(t, tau, zeta, wn, wd, w, t0) (tau/t0).*exp(zeta*wn*tau).*sin(wd*tau);
%for 0 < t < t0
for i = 1:numPoints
t = t_beforet0(i);
X1 = integral(@(tau) A(t,tau,zeta,wn,wd,w,t0),0,t);
X2 = integral(@(tau) B(t,tau,zeta,wn,wd,w,t0),0,t);
x_beforet0(i) = ((wn^2)/wd)*exp(-zeta*wn*t)*(sin(wd*t)*X1 - cos(wd*t)*X2);
end
%for t0 < t
X1 = integral(@(tau) A(t,tau,zeta,wn,wd,w,t0),0,t0);
X2 = integral(@(tau) B(t,tau,zeta,wn,wd,w,t0),0,t0);
for i = 1:5*numPoints
t = t_aftert0(i);
x_aftert0(i) = ((wn^2)/wd)*exp(-zeta*wn*t)*(sin(wd*t)*X1 - cos(wd*t)*X2);
end
Page 1 of 2Convolution_System_Response
5/22/2015file:///C:/Users/Owner/Documents/Mechanical%20Vibrations/html/Convolution_System_...
2. Published with MATLAB® R2012b
t = [t_beforet0 t_aftert0];
X_con = [x_beforet0 x_aftert0];
%==========================================================================
%Plotting
plot(t, X_con, t, x_IM, '--', t, x_stat, '-.');
legend('Convolution Integral', 'Impulse Momentum', 'Static Deflection');
title( 'fontsize{16} Non-periodic Forcing: Solution via Convolution');
xlabel('fontsize{12} Time [s]');
ylabel('fontsize{12} Displacement');
Page 2 of 2Convolution_System_Response
5/22/2015file:///C:/Users/Owner/Documents/Mechanical%20Vibrations/html/Convolution_System_...