Sie sind auf Seite 1von 31

Hilbert Vibration Decomposition

Matlab script
%
function [Y,A,om_r,dev]=hvd(x,n,fp); % % x - initial signal, n - number of decomposed components % Y - decomposed components, A - component envelopes , % F_r - component relative angular frequency % F=Fs*om_r/2/pi - Absolute frequecy [Hz], Fs -sampling frequency, % dev=std(Y_i)/std(Y_1)) - relative standard deviation of the decomposed component % % Example: [Y,A,om_r,dev]=hvd(x,2,0.02); % % LIMITATIONS: % The sampling frequency Fs has to be in the range Fs=(20-80)*f0. % The minimum of points in time domain is 230*3+1 = 691 % % 2011 Michael Feldman % For use with the book "HILBERT TRANSFORM APPLICATION % IN MECHANICAL VIBRATION", John Wiley & Sons, 2011 % if n>7; disp('Max number of components not greater than 7'); end if n<=0; disp('Number of components less than 1');Y=[];A=[];F_r=[];dev=[];return;end x=x(:); s(1)=std(x); if s(1)==0,Y=[];A=[];F_r=[];dev=[];disp('Zero signal');return,end; for k=1:n; [At,Ft,phit]=inst(x,1); omf=2*pi*lpf(Ft,fp);% Angular Frequency lowpass filtering (Smoothing) [yi,Ai,phi]=synchdem(x,omf,fp); Y(:,k)=yi; A(:,k)=Ai; om_r(:,k)=omf; % Angular Frequency, [Radians] x=x-yi; s(k)=std(x)/s(1); if k == 7, dev=[1 diff(s)]; return, end end dev=s; % Relative standard deviation of the components return %Example om=0.2+0.12*cos(0.4*(0:1023)); x=cos(cumtrapz(om)); [Y,A,F_r,dev]=hvd(x,3,0.05); figure(1); subplot(211) plot([x']) axis([400 600 -1.1 1.1]) ylabel('Initial signal')

subplot(212) plot(Y) axis([400 600 -1.1 1.1]) xlabel('Points') ylabel('Signal Components') figure(2) psd(x) %

Matlab script

%
Fs=1; % Sampling Frequency N=200;% Remez filter length n=2048; t=((0:n-1)/Fs)'; %% Example 1 (Denoising) %u=0.2*sin(0.1*t)+ 0.02*randn(n,1); %% Example 2 (Two harmonics) u=sin(0.05*t)+ 0.5*sin(0.3*(t)); [t,u1,yout]=sim('s16'); y=yout(:,1); A=yout(:,5); w=yout(:,6); yi=yout(:,2); Ai=yout(:,3); wi=yout(:,4); yi_2=yout(:,7);

figure(1) subplot(311) plot([y w A]) title('Composition') legend('Signal','Frequency', 'Envelope') subplot(312) plot([yi wi Ai]) title('Largest component') legend('Signal component','Frequency', 'Envelope') subplot(313) plot([yi_2]) title('Residual') xlabel('Time') legend('Next component') %

http://ht.technion.ac.il/Simulink/s16.mdl

Hilbert spectrum
%

function pl(Y,A,F_r,Fs) % Decomposed components and Hilbert spectrum presentation % % % % % % % % % % % % Y - Array of decomposed components (through HVD), A - Array of component envelopes, F_r - Array of component relative angular frequencies Fs -sampling frequency, F=Fs*F_r/2/pi - Plotted absolute frequecy [Hz], Example: pl(Y,A,F_r,1)

2011 Michael Feldman For use with the book "HILBERT TRANSFORM APPLICATION IN MECHANICAL VIBRATION", John Wiley & Sons, 2011

close all; N=0; % Number of the excluded points from the start/end s=size(Y); pp=N+1:length(Y)-N; t=pp/Fs; % Time dec=round(s(1)/150); c=['k- '; 'b- '; 'r- '; 'm if s(2)>7 s(2)=7; end F=F_r*Fs/2/pi; % '; 'g- '; 'c- '; 'y- ' ];

Frequency, [Hz]

for k=1:s(2), figure(1); subplot(s(2),1,k,'align'); plot(t,Y(pp,k),c(k,:));grid on;drawnow; ylabel(['^Y' int2str(k)]); axis([min(t) max(t) min(Y(pp,k)) max(Y(pp,k))]); xlabel('Time, s'); figure(2); subplot(211); plot(t,F(pp,k),c(k,:),'Linewidth',2);drawnow;hold on; grid on; axis([min(t) max(t) 0 1.2*max(max(F(pp,:)))]); ylabel('Frequency, Hz'); subplot(212); plot(t,A(pp,k),c(k,:),'Linewidth',2);drawnow;hold on; grid on; axis([min(t) max(t) 0 1.2*max(max(A(pp,:))) ]); ylabel('Amplitude') xlabel('Time, s'); figure(3); subplot(211) plot(t,Y(pp,k),c(k,:));drawnow;hold on; grid on; axis([min(t) max(t) min(min(Y(pp,:))) max(max(Y(pp,:)))]); ylabel('Y');

end figure(1); subplot(s(2),1,1,'align'); title('Components'); figure(2); subplot(211); title('Component instantaneous frequency'); subplot(212); title('Component envelope'); figure(3); subplot(211); title('Components'); subplot(212); plot(t,sum(Y(pp,:)')); drawnow; grid on; axis([min(t) max(t) min(sum(Y(pp,:)')) max(sum(Y(pp,:)'))]); xlabel('Time, s'); ylabel('Y'); title('Sum of components') figure(4); for k=1:s(2), stem3(t(1:dec:length(pp)),F(pp(1:dec:length(pp)),k),(A(pp(1:dec:length(pp )),k)),c(k),'.'); hold on;drawnow; end xlabel('Time, s');ylabel('Frequency, Hz');zlabel('Amplitude') axis([min(t) max(t) 0.7*min(min(F(pp,:))) 1.3*max(max(F(pp,:))) min(min(A(pp,:))) max(max(A(pp,:)))]); title('Hilbert spectrum') view(-50,70); %tilefigs([2 2],20) return % Example om=0.2+0.12*cos(0.4*(0:1023)); x=cos(cumtrapz(om)); [Y,A,F_r,dev]=hvd(x,3,0.05); pl(Y,A,F_r,2*pi) %

Hilbert spectrum with frequency arranging


%
function plfreq(Y,A,F_r,Fs) % Plots the decomposed components with frequency arranging % for Hilbert spectrum presentation with frequency arranging % % % % % % % % % % % % Y - Array of decomposed components (through HVD), A - Array of component envelopes, F_r - Array of component relative angular frequencies Fs -sampling frequency, F=Fs*F_r/2/pi - Plotted absolute frequecy [Hz], Example: plfreq(Y,A,F_r,1)

2011 Michael Feldman For use with the book "HILBERT TRANSFORM APPLICATION IN MECHANICAL VIBRATION", John Wiley & Sons, 2011

close all; N=0; % Number of the excluded points from the start/end s=size(Y); pp=N+1:length(Y)-N; t=pp/Fs; % Time dec=round(s(1)/150); c=['k- '; 'b- '; 'r- '; 'm if s(2)>7 s(2)=7; end F=F_r*Fs/2/pi; % '; 'g- '; 'c- '; 'y- ' ];

Frequency, [Hz]

[F1,I]=sort(F'); F=F1'; %for j = 1:s(2), Y1(:,j) = Y(I(:,j),j); end ; Y=Y1'; %for j = 1:s(2), A1(:,j) = A(I(:,j),j); end ; A=A1'; for j = 1:s(1), Y1(j,:) = Y(j,I(:,j)); end ;Y=Y1; for j = 1:s(1), A1(j,:) = A(j,I(:,j)); end ;A=A1; for k=1:s(2), figure(1); subplot(s(2),1,k,'align'); plot(t,Y(pp,k),c(k,:));grid on;drawnow; ylabel(['^Y' int2str(k)]); axis([min(t) max(t) min(Y(pp,k)) max(Y(pp,k))]); xlabel('Time, s'); figure(2); subplot(211); plot(t,F(pp,k),c(k,:),'Linewidth',2);drawnow;hold on; grid on; axis([min(t) max(t) 0 1.2*max(max(F(pp,:)))]); ylabel('Frequency, Hz'); subplot(212); plot(t,A(pp,k),c(k,:),'Linewidth',2);drawnow;hold on;

grid on; axis([min(t) max(t) 0 1.2*max(max(A(pp,:))) ]); ylabel('Amplitude') xlabel('Time, s'); figure(3); subplot(211) plot(t,Y(pp,k),c(k,:));drawnow;hold on; grid on; axis([min(t) max(t) min(min(Y(pp,:))) max(max(Y(pp,:)))]); ylabel('Y'); end figure(1); subplot(s(2),1,1,'align'); title('Components'); figure(2); subplot(211); title('Component instantaneous frequency'); subplot(212); title('Component envelope'); figure(3); subplot(211); title('Components'); subplot(212); plot(t,sum(Y(pp,:)')); drawnow; grid on; axis([min(t) max(t) min(sum(Y(pp,:)')) max(sum(Y(pp,:)'))]); xlabel('Time, s'); ylabel('Y'); title('Sum of components') figure(4); for k=1:s(2), stem3(t(1:dec:length(pp)),F(pp(1:dec:length(pp)),k),(A(pp(1:dec:length(pp )),k)),c(k),'.'); hold on;drawnow; end xlabel('Time, s');ylabel('Frequency, Hz');zlabel('Amplitude') axis([min(t) max(t) 0.7*min(min(F(pp,:))) 1.3*max(max(F(pp,:))) min(min(A(pp,:))) max(max(A(pp,:)))]); title('Hilbert spectrum') view(-50,70); %tilefigs([2 2],20) return % Example clear; close all Fs=1; % Sampling frequency [Hz] dt=1/Fs; % Time sample interval [s] n=1024; % signal length T=dt*(n-1); % Signal duration [s] t=(0:dt:T)'; % Time vector f01=0.02*ones(1,length(t)); % Signal amplitude A01=0.005+0.06.*linspace(0,1,length(t)); % Signal frequency [Hz] f02=0.05*ones(1,length(t)); % Signal amplitude A02=0.04-0.02.*linspace(0,1,length(t)); % Signal frequency [Hz] x1=A01.*cos(2*pi*cumtrapz(f01.*dt)); % Signal x2=A02.*cos(2*pi*cumtrapz(f02.*dt)); % Signal x=x1+x2; [Y,A,F_r,dev]=hvd(x,2,0.05); plfreq(Y,A,F_r,2*pi)

%
function [Ac, Fc]=congr(Y,A,F_r) % % % % % % % % % Congruent envelope and instantaneous frequency Y - decomposed components, A - component envelopes , F_r - component relative angular frequency Example: [Ac, Fc]=congr(Y,A,F_r);

2011 Michael Feldman For use with the book "HILBERT TRANSFORM APPLICATION IN MECHANICAL VIBRATION", John Wiley & Sons, 2011

S=size(Y); k=S(2); if k==1, Ac=A(:,1); Fc=(F_r(:,1))./Ac; else for l=2:k phi(:,l)=coph(Y(:,1),Y(:,l)); Ac(:,l)=A(:,l).*cos(pi.*phi(:,l)/180); Fc(:,l)=A(:,l).*F_r(:,l).*cos(pi.*phi(:,l)/180); end Ac=A(:,1)+sum(Ac')'; Fc=(F_r(:,1)+sum(Fc')')./Ac; end

return % Example x1=cos(0.1*(1:1024)); x2=0.3*cos(0.3*(1:1024)); x=x1-x2; [Y,A,F_r,dev]=hvd(x,2,0.05); [Ac, Fc]=congr(Y,A,F_r); figure(1) plot([x' Ac Fc]); legend('Signal','Congruent envelope','Congruent frequency') %

Vibration system modeling

Nonlinear free vibration


%
close all; clear Fs=16; % Sampling frequency a1=1; % Linear angular frequency squared f0=1/2/pi=0.16 a3=10; % Cubic nonlinear stiffness a5=0.0; % Nonlinear stiffness b1=0.05; % Linear damping b2=0; % Nonlinear damping x0=1e0; % Initial velocity sim('s19', 2e2); % Simulate a Simulink model figure(1) plot(y); grid on xlabel('Points, s'); ylabel('Displacement'); title(['Free vibration, a1=' num2str(a1) ', b1=' num2str(b1)]); %

Nonlinear forced vibration


close all; clear Fs=3000; % Sampling frequency, [Hz] t_stop=2.5; % stop simulation time f_start=20; % Initial frequency [Hz] f_stop=90; % Stop frequency {Hz} a1=(2*pi*30)^2; % Linear angular frequency squared f0=1/2/pi=0.16 [Hz] a3=2000; % Cubic nonlinear stiffness a5=0.0; % Nonlinear stiffness d=0.0; % Dead zone (Backlash) b1=2*2.5; % Linear damping b2=0; % Nonlinear damping sim('s20', t_stop); % Simulate a Simulink model figure(1) subplot(211) plot(x); axis tight subplot(212) plot(y,'k'); grid on axis tight xlabel('Points, s'); ylabel('Displacement'); title(['Free vibration, a1=' num2str(a1) ', b1=' num2str(b1)]); %

Asymmetric vibration
%
close all; clear Fs=1000; % Sampling frequency, [Hz] t_stop=10; a1=(2*pi*10.0)^2; %The positive stiffness, a2=(2*pi*20.0)^2; % The negative stiffness b=2; % Linear damping

f0=10 [Hz]

sim('s21', t_stop); % Simulate a Simulink model figure(1) plot(y,'k'); grid on axis tight xlabel('Points, s'); ylabel('Displacement'); title(['Asymmetric free vibration, a1=' num2str(a1) ', num2str(a2)]); %

a2='

Two DOF system vibration


%
clear; close all eta=1.0; k1=(0.1592*2*pi)^2; k2=(0.3*2*pi)^2; c1=0.008; c2=0.01; m1=1; m2=1; alpha=0.0; beta=3.0; Fs=5; % Sampling frequency, [Hz] t_stop=6e2; sim('s22', t_stop); % Simulate a Simulink model figure(1); subplot(211) plot(y1,'b'); axis tight ylabel('1st mode'); subplot(212) plot(y2,'k'); axis tight xlabel('Points'); ylabel('2nd mode'); title(['Free vibration, \eta=' num2str(eta) ', k1=' num2str(k1) ', k2=' num2str(k2) ', c1=' num2str(c1)]); %

Vibration system IDENTIFICATION

FREEVIB identification
ff1=sqrt(abs(4.*pi^2.*f0.^2-2*h.^2+4.*pi.*f0.*h.*... sqrt( (max(A))^2./(A.^2 +eps) -1+... (h).^2./(4.*pi^2.*f0.^2+eps))))/2/pi ; ffi=4.*pi^2.*f0.^2-2*h.^2-4.*pi.*f0.*h.*... sqrt( (max(A))^2./(A.^2 +eps) -1+... (h).^2./(4.*pi^2.*f0.^2+eps)); ind_ffi=find(ffi>0); ff2=zeros(length(y),1); ff2(ind_ffi)=sqrt(ffi(ind_ffi))./2/pi; FRF=[ff1 ff2]; % Freqyency Response Function

subplot(111); plot(FRF(pp,:),A(pp),'r--','LineWidth',1);hold on plot(f0(pp),A(pp),'b','LineWidth',2); xlabel('Frequecy, Hz');ylabel('Amplitude'); title(['Back-Bone, FRF']); grid on; % Static force calculation figure(3);set(3,'Position',[509 42 482 284]); iel=find(y > 0.98*A & y < 1.02*A); yH = hilbfir(y); ifr=find(yH > 0.97*A & y < 1.03*A); iel(iel=pp(length(pp)))=[]; ifr(ifr=pp(length(pp)))=[]; fofr=2*h(ifr).*Ayd(ifr); % Friction Force foel=4*(pi*f0(iel)).^2.*A(iel); % Elastic force subplot(121); plot([-A(iel) A(iel)],[-foel foel],'k.'); hold on plot([-A(iel) A(iel)],[-foel foel],'g'); title('Elastic Static Force'); ylabel('Elastic Force'); xlabel('Displacement') grid on; hold off subplot(122); plot([-Ayd(ifr) Ayd(ifr)],[-fofr fofr],'k.'); hold on plot([-Ayd(ifr) Ayd(ifr)],[-fofr fofr],'m'); title('Friction Force'); xlabel('Velocity');ylabel('Friction Force') grid on; hold off; returrn

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load duffrd [z,A,f0,h,Ayd]=freevib(y,Fs,'d'); plfree(z,A,f0,h,Ayd); %

Free Vibration identification (FREEVIB)


%
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 = f = f0 = d = h1 = Ayd= y = h2 = yout(:,1); yout(:,2); yout(:,3); yout(:,4); yout(:,5); yout(:,6); yout(:,7); yout(:,8); % % % % % % % The The The The The The The Envelope instantaneos frequency natural frequency decrement damping coefficient envelope initial signal

% Lowpass filtering fp=0.02;

A f0 h Ayd

= = = =

lpf(A, fp); lpf(f0,fp); lpf(h1,fp); 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') %

http://ht.technion.ac.il/Simulink/s23.mdl

FORCEVIB identification
%
function [yy,A,f0,h,Ayd,f,m]=forcevib(x,y,Fs,stype); % Function FORCEVIB (Forced Vibration Analysis) % It determines instantaneous modal parameters of % linear and non-linear vibration SDOF system under forced % quasiharmonic excitation input. % Input: % Vector y is a forced vibration signal in time domain, % Vector x is an input force excitation, % stype is a signal type, e.g. displacement, velocity, or acceleration. % Fs is the sampling frequency [Hz] % % Output: % yy - displacement, A - envelope, f0 - natural frequency [Hz], % h - damping coefficient [1/sec],Ayd - envelope of the velocity, % f - instantaneous frequency [Hz], m - mass value % % m*y'' + 2*m*h*y' +m*(2*pi*f0)^2*y = x % % EXAMPLE: % [yy,A,f0,h,Ayd,f,m]=forcevib(x,y,1000,'d'); % % LIMITATIONS: % The sampling frequency Fs has to be in the range Fs=(10-100)*f0. % The minimum of points in time domain is 3*230+1. % % 2011 Michael Feldman % For use with the book "HILBERT TRANSFORM APPLICATION % IN MECHANICAL VIBRATION", John Wiley & Sons, 2011 % N=230; if length(y)<=3*N+1, error('The length of the signal y must be more than three times the filter order'),end; if nargin<4, error('Not enough input arguments'), end; if length(y)~=length(x), error('The length of the signal y must be equal to the length of the force excitation'),end; s=strmatch(lower(stype),{'displacement','velocity','acceleration'}); if s==0,error('Wrong signal type'); y=y(:); elseif s==1, yH = hilbfir(y); yd = diffir(y,Fs); ydd = diffir(yd,Fs); yHd = hilbfir(yd); yHdd= hilbfir(ydd); elseif s==2 yd = y; % Displacement Hilbert transform % Velocity % Aceleration % Hilbert velocity % Hilbert aceleration % Velocity

y = yH = ydd = yHd = yHdd=

integ(yd,Fs); hilbfir(y); diffir(yd,Fs); hilbfir(yd); hilbfir(ydd);

% % % % % % % % %

Displacement Displacement Hilbert transform Aceleration Hilbert velocity Hilbert aceleration Acceleration Velocity Displacement Displacement Hilbert transform % Hilbert velocity % Hilbert aceleration

elseif s==3 ydd=y; yd = integ(ydd,Fs); y = integ(yd,Fs); yH = hilbfir(y); yHd = hilbfir(yd); yHdd= hilbfir(ydd); end yy=y; xH = hilbfir(x); xd = diffir(x,Fs); xHd = diffir(xH,Fs);

% Force Hilbert % Force derivative % Force Hilbert derivative

% Algebraic transforms and instantaneous modal parameters calculation. A2=(yH.^2+y.^2); A=sqrt(A2); % A -- Vibration amplitude, var2=(y.*yHd-yd.*yH); om_y=var2./A2; % om_y -- Vibration frequency,[rad] var4=(-y.*ydd-yH.*yHdd); %%?? om0_2=(yHdd.*yd-yHd.*ydd)./(var2+eps); % om_02 -- Undamped natural frequency, transient [rad] h0=0.5*(yH.*ydd-yHdd.*y)./(var2+eps); % h0 -- Damping coefficient, transient [1/s] Ad_A_om=(y.*yd+yH.*yHd)./(var2+eps); % Ayd2=(yHd.^2+yd.^2); Ayd=sqrt(Ayd2); % Ayd -- Velocity amplitude, Ax2=(xH.^2+x.^2); Ax=sqrt(Ax2); % A alpha= (x.*y+xH.*yH)./(A2+eps); log.decrement, beta = (xH.*y-x.*yH)./(A2+eps); xHy-xyH om_x = (x.*xHd-xH.*xd)./(Ax2+eps); f=om_x/2/pi; om2=om_x.^2; pp=233:length(y)-233; [P,S]=polyfit(alpha(pp)-beta(pp).*Ad_A_om(pp),om0_2(pp),1); m=1/P(1); [As,inAs]=sort(A(pp)); % Sorting Amplitude inAs=inAs+pp(1)-1; dinAs=diff(inAs); z=find(abs(dinAs)>200); ppz=inAs(z); if length(ppz)>=100; disp('PLEASE WAIT') options = optimset('Display','off'); % Optimization for Natural Frequency m=-lsqnonlin(@omer,m,[],[],options); end -- Force amplitude, % Item of denominator of % Item of numerator of log.decrement % om_x -- Vibration frequency,[rad]

om01_2=alpha./m-beta.*Ad_A_om/m+om0_2; h=h0+0.5*A2.*beta./(var2+eps)./m; % Low pass filtration (Result fp=0.02; f = lpf(f,fp); % A = lpf(A,fp); % f0 = sqrt(abs( lpf(om01_2,fp) h = lpf(h,fp); % Smoothing) Frequency [Hz] Amplitude, Displaycement ))/2/pi; % Natural frequency [Hz] Damping [1/s]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function F = omer(m); shift=20; om01_2i=[]; er=[]; for i=1:length(ppz)-shift; om01_2i=alpha(ppz(i:i+shift))./mbeta(ppz(i:i+shift)).*Ad_A_om(ppz(i:i+shift))/m-om0_2(ppz(i:i+shift)); er(i)=std(om01_2i); end F=er; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% returrn %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load duffod [yy,A,f0,h,Ayd,f,m]=forcevib(x,y,Fs,'d'); plfor(yy,A,f0,h,Ayd,f,m); %

Das könnte Ihnen auch gefallen