%% Frequency-Response Function of Hammer Excitation
% Visualize the frequency-response function of a single-input/single-output hammer excitation.
%
% Load a data file that contains:
% Xhammer \text{---} An input excitation signal consisting of five hammer blows delivered periodically.
% Yhammer \text{---} The response of a system to the input. Yhammer is measured as a displacement.
%  The signals are sampled at 4 kHz. Plot the excitation and output signals.

load modaldata

subplot(2,1,1)
plot(thammer,Xhammer(:))
ylabel('Force (N)')
subplot(2,1,2)
plot(thammer,Yhammer(:))
ylabel('Displacement (m)')
xlabel('Time (s)')

%
% Compute and display the frequency-response function. Window the signals using a rectangular window. Specify that the window covers the period between hammer blows.

clf
winlen = size(Xhammer,1);
modalfrf(Xhammer(:),Yhammer(:),fs,winlen,'Sensor','dis')

% Copyright 2012 The MathWorks, Inc.