FREEVIB (Simulink)

clear all; close all;

load duffrd.mat

%Fs=1000; % Sampling Frequency
t=((1:length(y))/Fs)’;
u=y;

N=220; % Remez filter length
sim(‘s23.mdl’);

A = yout(:,1); % The EnvelopeModel
f = yout(:,2); % The instantaneos frequency
f0 = yout(:,3); % The natural frequency
d = yout(:,4); % The decrement
h1 = yout(:,5); % The damping coefficient
Ayd= yout(:,6); % The envelope
y = yout(:,7); % The initial signal
h2 = yout(:,8);

% Lowpass filtering

fp=0.02;
A = lpf(A, fp);
f0 = lpf(f0,fp);Solution
h = lpf(h1,fp);
Ayd = lpf(Ayd,fp);

% Result plotting
pp=600:length(y);
figure(1);
subplot(2,2,[1:2])
plot([y A])
axis(‘tight’)
xlabel(‘points’)
title(‘Signal and Envelope’)
subplot(2,2,3)
plot(f0(pp),A(pp),’.’)
axis([0 1.5*max(f0(pp)) 0.9*min(A()) 1.1*max(A(pp)) ]);
title(‘Skeleton curve’)
xlabel(‘Frequency, Hz’)
ylabel(‘Amplitude’)
subplot(2,2,4)
plot(h(pp),A(pp),’.k’)
axis([0 2*max(h(pp)) 0.9*min(A()) 1.1*max(A(pp)) ]);
title(‘Damping curve’)
xlabel(‘Damping coefficient, 1/s’)
ylabel(‘Amplitude’)