Ex4_20 - Displacement (m)') npts = (tf-t0)/dt+1; for i =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% This program calculate forced response of an underdamped system % under general periodic excitation. global tau F; g tau = 2; F = 1; F t0 = 0; tf = 5*tau; dt = 0.1; tspan = [t0: dt: tf]; x0 = [0.0; 0.0]; [t, x] = ode45('dfunc4_20', tspan, x0, []); disp('Time (sec) Force (N)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Displacement (m)') npts = (tf-t0)/dt+1; for i = 1:npts time = mod(t(i),tau); f(i,1) = time/tau*F; end disp([t f(:,1) x(:,1)]) d plot(t, f(:,1), '--'); hold on; plot(t, x(:, 1)); xlabel('t'); ylabel('f & x(1)'); title('Forcing function and displacement');...
View Full Document

Ask a homework question - tutors are online