Sie sind auf Seite 1von 26

Project 2

VIBRATION CHARACTERIZATION OF A CANTILEVERED


FLEXIBLE BEAM

CHRISTOPHER BALINO
CHRISTOPHER BRENNAN
SAM GREEN
ERIC HOLTZMAN
OLIVER QUADROS

Mechatronic Systems
Northeastern University

April 13th, 2015

TABLE OF CONTENTS
ABSTRACT........................................................................................................................................ 3
INTRODUCTION AND LITERATURE REVIEW .................................................................. 4
THEORY............................................................................................................................................. 5
RESULTS ........................................................................................................................................ 10
ANALYSIS ...................................................................................................................................... 17
CONCLUSION ............................................................................................................................... 18
APPENDIX ..................................................................................................................................... 19
Solution And Simulation Data .......................................................................................... 19
System Parameters And Flow Charts ............................................................................ 20
Equations And Sample Calculations .............................................................................. 21
Simulink And Matlab Code................................................................................................. 21
Simscape Model ........................................... ! .

ABSTRACT
Microcantilevers, or small, projecting beams fixed only at one end, can be incorporated into
microelectromechancial systems (MEMS) for use in atomic force microscopy and biological
sensing. Due to the sensitive nature of these systems, it becomes necessary to accurately
characterize the physical properties of the cantilever in order to minimize unwanted
behavior. The objective of this study was to experimentally determine damping and
stiffness, using a known mass, for comparison against an established model. This model
consisted of a cantilever with a piezoelectric patch attached near its base. The equations of
motion were generated using the finite element method in order to account for the sections
with and without the piezo patch. From the assumed mode method, two eigensystems were
realized, which, when solved, yielded the properties of the cantilever in terms of mass,
damping, and stiffness. The results of this model gave the natural frequencies of the
cantilever occurring at f1= 9.475 Hz, f2=56.74 Hz, and f3= 152.7 Hz for the first three modes
respectively. Experimentally, these properties were determined by measuring the vibration
outputs of the cantilever upon a linear sine chirp excitation. Using the Fast Fourier
Transform, the natural frequencies of the system were found at f1= 7.70.3 Hz, f2=46.00.4
Hz, and f3= 1200.4 Hz for the first three modes, respectively. The discrepancies between
the experimental and theoretical results can be attributed to un-modeled dynamics and
energy loss within the system and can be improved through proper tuning of the system
parameters.

INTRODUCTION AND LITERATURE REVIEW


Cantilever beams are perhaps one of the most widely used and studied beams in
engineering. Cantilevers are beams that are fixed at one end and are free to overhang at the
other. These beams are abundant in industry, most prominently in applications as diverse
as buildings/structures, bridges, aircraft wings, atomic force microscopy (AFM)[1] and,
more recently, microelectromechanical systems (MEMS). Microcantilevers and
nanocantilevers are especially a topic of interest in the biomedical engineering field. They
have the potential to diagnose health issues such as prostate cancer, myocardial infarction,
and glucose monitoring by using highly sensitiveminiaturized biochips based on an array of
micro- and nanocantilevers[2].
Characterization of cantilever beams is an important step in the modeling and design of
these beams for various applications. It is necessary to know the natural modes of vibration
in a system in order to construct an appropriate beam for a given application with desired
responses. This also avoids unwanted resonance and possible damage or destruction of
these devices. Characterization also allows for the design of controllers for the beams that
can be used to minimize or eliminate unwanted responses and resonances. A controller can
only be well developed when a system - the cantilever beam, in this case - is fully or
sufficiently characterized in order to get adequate responses to applied inputs or
disturbances. If not enough characteristics are known about the system, a developed
controller could have little to no effect on the response or actually worsen the response of
the system.
This experiment deals with the characterization of a thin cantilever beam fixed at one end with a
piezoelectric (PZT) patch near the fixed end, and a Polytec Laser Doppler Vibrometer aimed at
the free-hanging end to collect velocity data at the tip. The collected data was then processed
using Fast Fourier Transform (FFT) in order to convert this data from the time domain to the
frequency domain (which is necessary to determine the resonance frequency). The data can then
be used to calculate the auto-power spectrum for both the input (force) and output (velocity and
acceleration). Frequency response functions (FRFs) are computed from the power spectrum data,
and the resonance frequency can be found graphically from these FRFs. This can then be used to
calculate the stiffness and damping characteristics of the system.
[1] Bilbao, Stefan and Julius O. Smith. Discrete-Time Lumped Models. Center for
Computer Research in Music and Acoustics (CCRMA). Stanford University, (2014).
[2]J. Chaskalovic, Finite Elements Methods for Engineering Sciences, Springer Verlag,
(2008).
[3] Torby, Bruce. "Energy Methods". Advanced Dynamics for Engineers. HRW Series in
Mechanical Engineering. United States of America: CBS College, (1984).
[4] Tribology Group. Rotordynamics Laboratory. Texas A&M Univerisity. (2015).
[5] Gere, J. M. and Timoshenko, S. P., 1997, Mechanics of Materials, PWS Publishing
Company. (2011).

[6] SM Khot, Nitesh P Yelve, Rajat Tomar, Sameer Desai and S Vittal. Active Vibration
Control of Cantilever Beam by using PID based output feedback controller. Journal of
Vibration Control. (2011).

PARAMETER

SYMBOL

VALUE AND UNITS

DENSITY

2700 /3

YOUNGS MODULUS

69 109

LENGTH

244.5

WIDTH

25.4

THICKNESS

= 0.6

AREA MOMENT OF INERTIA FOR


RECTANGULAR CROSS SECTION

3
12

CONSTANT FOR 1ST MODE

3.52

CONSTANT FOR 2ND MODE

22.03

CONSTANT FOR 3RD MODE

61.70

CONSTANT FOR 4TH MODE

120.90

THEORY
The microcantilever-based sensor is comprised of a projecting beam with a piezoelectric
patch attached to its base. Since the beam is fixed at one end, the forces experienced by the
system vary as a function of distance. As a result, the cantilevers motion must be
characterized using the distributed parameter method, which describes systems asa
function of time and one or more spatial variables (1). For reference, a diagram of the
theoretical model is depicted in Figure 1with thickness t, width W and length L given as
dimensions for the piezo patch and beam respectively.

z
Beam

Piezo
tb
tp

W
W

Lp
Figure 1A diagram of the theoretical model.

The equations of motion were derived using the finite element method, which breaks the
system into simpler parts and approximates a solution by solving the individual boundaryvalue problems (2).Here, the cantilever was divided into two sections to account for the
section with the piezo patch and the section without the piezo patch. From Hamiltons
principle, a particle will follow the path that minimizes its action according to the equation
2

, ,
1

where S is the resulting path and L is the Lagrangian given as the difference between the
kinetic and potential energies for the variable q. An extension of this principle, called the
principle of virtual work, states that the work of the applied forces on a particle is zero for
all possible movements of that particle from static equilibrium (3). That is a particle
disturbed from static equilibrium will return to static equilibrium and due to path
independence the work done on that particle will be zero. Therefore, since the cantilever
starts from static equilibrium, the motion of the two sections can be described from the
principle of virtual work given as
=

2
1

1 + 2 1 + 2 + =0

where the operator denotes a functional derivative and Wncdenotes work from nonconservative forces. From here, the equations of motion for each section can be written as

+
0

2 1

( )

( )

4 1
)
4

= 0

and

2 2
2

4
( ) 2
4

= 0 .

Further, the eight boundary conditions, two geometric and two natural for each section,
can be derived by evaluating these equations at the endpoints 0, Lp, and L. Using the
assumed mode method, the equivalent mass and stiffness of the cantilever beam can be
estimated from a chosen mode shape that is consistent with the boundary conditions (4).
These assumed mode shapes are solutions to the eigenvalue problem for the cantilever
beam and can be given as the following eigenfunctions:
1 = 1 sin(1 ) + 1 cos 1 + 1 sinh 1 + 1 cosh 1
and
2 = 2 sin(2 ) + 2 cos 2 + 2 sinh 2 + 2 cosh 2
where 1 and 2 are eigenfunction constants and A1-D2 are eigenfunction coefficients. Note
that the values of the eigenfunction coefficients depend on the given boundary conditions,
yetthe eigenfunction constants are independent of these conditions since they relate to the
natural frequencies of the system (5). From here, 2 can be written in terms of 1 as

2 = 1

( )

( )

1/4

( )

which gives the relation between natural frequency (Hz) and the 1 values as
12
=
2

( ) + ( ) )
( + )

1/2

Through orthonormalization of the discontinuous cantilever, the eigenvalue problem can


be solved for the multi-degree-of-freedom system given by
+ + =
thus yielding the eigenvectors x1 and x2, which can be put into state space as according to:
=

0
1

1
1 11

0
1

= 2

(1)

= 0,
for mass M=1 , stiffness K=12 , and input force F (6). Further, the viscous damping for the
system can be calculated from these parameters through the following relation:
11 =

(1) 2

(1) 2

Additionally, orthonormalization allows for the equation of motion for the first mode to be
written as
2

+ 2 (1) + (1) = 1
where q is the strain measured by the strain gage and F is the input piezo voltage. This
equation of motion yields a transfer function for the first mode that can be found by simply
measuring the first mode frequency, 1 , and the damping ratio of the system, .
In order to experimentally determine the resonance frequencies of the structure an active
piezoelectric actuator was used to input a linear sine chirp from 0-400 Hz and force,
velocity, and acceleration data were recorded. The recorded data was then analyzed using
MATLABs Fast Fourier Transform algorithm and used to calculate the autopower spectra.
The four autopower spectra were calculated using Eq. 6 through Eq. 9 as given here:
=

(6)

(7)

(8)

(9)

where denotes the input FFT (force data or piezo voltage), denotes the output FFT
(velocity or acceleration data) and * denotes the complex conjugate.
The calculated autopower spectra were then used to calculate the frequency response
functions given by Eq. 10 and Eq. 11 here:

1 =

(10)

2 =

(11)

The coherence was then determined with Eq. 12 here:

= 1 (12)
2

The frequency response functions were used to determine the resonance frequencies of the
structure. Both 1 and 2 were graphed and the most intense peaks within the usable
range of frequency data was taken as the resonance frequencies of the structure. The
damping ratio was then determined using the half-power bandwidth method around the
fundamental frequency. The damping ration is given by:
=

2 1
2

(13)

where 2 and 1 were taken as the 3db frequency values on the positive and negative side
of the fundamental frequency ( ), respectively.
Equation X below gives the formula for the expected modal frequencies of a cantilever
beam.
=

, = 1
4

Using Equation 1 and the 4 given values for14 , the expected modal frequencies are,
8.2056, 51.3547, 143.8305, 281.8331 Hz.

The damping ratio and fundamental frequency were then plugged into equation X and used
to calculate the transfer function of the first mode of the system. This was used to simulate
the response of the system using Simulink in order to validate the model. In the future, this
transfer function will be used to develop a controller to damp the first modal response of
the cantilever system.

RESULTS

Figure 2Raw Force, Velocity, and Acceleration Data

Figure 3One window of the raw data

Figure 2 displays the raw experimental data recorded by the force transducer,
accelerometer, and laser vibrometer with a sampling frequency of 400 Hz. The structure
was subjected to 40 input linear sine chirps lasting 1.25 seconds each. Accordingly, the
recorded data was windowed into 40 blocks as seen by the dashed rectangles in Figure 2.
Figure 3 displays a single block of recorded data. During analysis, each block was analyzed
individually. First the data was windowed using the MATLAB hanning window algorithm
and a fast fourier transform was performed. The frequency data was then used to calculate
the autopower and cross-power spectra for piezo-voltage and force inputs and velocity and
acceleration outputs. The calculated cross-power spectras were then averaged for all
blocks and used to calculate the Frequency Response Functions given by Eq. 10 and Eq. 11.
The frequency response functions were calculated for force-velocity, force acceleration,
piezovoltage-velocty, and piezovoltage-acceleration.

Figure 4Coherence of Chirp-Velocity Data

Figure 6Coherence of Chirp-Accel. Data

Figure 5Coherence of Force-Velocity Data

Figure 7Coherence of Force-Accel. Data

The coherence was calculated for the frequency response formulas and is displayed in
Figures 4 through 7. The coherence is near one over nearly the entire sampled frequency
range for all data sets.

Figure 8Chirp-Velocity FRF Magnitudes

Figure 9Force-Velocity FRF Magnitudes

Figure 10Chirp-Acceleration FRF Magnitudes

Figure 11Force-Acceleration FRF Magnitudes

Figures 8 and 9 display the magnitude of the frequency response function calculated from
the experimental velocity data. Figures 10 and 11 display the same information calculated

from the experimental acceleration data. The frequency response function phase data is
displayed in Figures 12 and 13 for the experimental velocity data and in Figures 14 and 15
for the acceleration data.

Figure 12Chirp-Velocity FRF Phase

Figure 13Force-Velocity FRF Phase

Figure 14Chirp-Acceleration FRF Phase

Figure 15Force-Acceleration FRF Phase

The chirp-velocity and force-velocity FRF magnitudes (shown in Figures 8 and 9 above)
were used to determine the resonance frequencies of the cantilever beam and its damping
ratio. The acceleration data was not used because it did not display clear frequency peaks.
This is most likely due to the fact that the acceleration was recorded by the force
transducer, which is located below the base of the cantilever beam, which is actually the
pivot point and should not be moving. This is The resonance frequencies were found to be
1 = 7.7 0.3 , 2 = 46.0 0.4 , and 3 = 120 0.4 . The damping ratio was
calculated to be = 0.04 0.01.
The first resonance frequency and damping ratio of the system were then used to calculate
the transfer function describing the relationship between piezo voltage input and strain

gauge output as described above. Figure 16 displays the FRF magnitudes of the simulated
first mode system. Figure 17displays the FRF phases of the first mode system and Figure
18shows the phases over the phase range of the frequency peak. The resonant frequency of
the FRF magnitude plot was found to be 7.6 Hz: very near the experimental first mode of
the actual system.

Figure 16FRF Plot for Simulink Simulation for 1st Mode Transfer Function

Figure 17FRF Phase Plot of Simulink Simulation for 1st Mode Transfer Function.

Figure 18 FRF Phase Plot with Magnified Area of Interest around 1st Natural Frequency

ANALYSIS
As described in the Theory section above and shown in Figure A1 the expected natural
frequencies of the microcantilever beam are 8.194, 51.37, 143.8, 281.8 Hz. The
microcantilever can also be more simply described by equation 1 above. This produces
similar frequency values of 8.2056, 51.3547, 143.8305, 281.8331 Hz. The experimental
data obtained was valid over a range of 0 to 200 Hz allowed the first 3 modes of the beam
to be captured. The natural frequencies were found experimentally to be1 = 7.7
0.3 ,2 = 46.0 0.4 , and 3 = 120 0.4 as visible in Figure 10. It is clear that the
experimental frequencies found are lower than those mathematically expected. This is to
be expected as any fully non-rigid parts or loss of energy would change the reaction of the
system. Also, the addition of a piezopatch, which was used as the actuator in this
experiment, would change the dynamics of the modeling. As shown in Figure A2, when
modeling the beam with the piezopatch, the expected frequencies for the first three modes
raise to 9.475, 56.74, and 152.7 Hz. Again, this means that the experimental frequencies are
lower than the theoretical frequencies as expected.
Figures 6-9 represent the coherence plots of thefour different FRF data sets. Initially at
very low frequencies, the coherences of all plots are very low. However, at ranges greater
than 40 Hz the coherence of all plots was near 1. However, the acceleration data was not
used to calculate experimental frequencies because the resonant peaks of the system were

not clearly visible. This is most likely due to the force transducers location under the base
of the beam. The reading from the force transducer was not accurate and could not be used
to correctly model the system response.The Chirp-Velocity and Force-Velocity FRF plots
(Figure 11) show the three experimental natural frequencies of 7.7, 46.0, and 129 Hz.
These graphs are much cleaner than Figures 10 and 11 which show the acceleration FRF
data and more accurately measure the frequency response of the system.
Comparing phase plots can also help in analyzing system and frequency behavior.Figures
12 and 13 represent the two velocity FRF phase plots. They also accurately show the
transient region of phase change of the system at the first three natural frequencies. Again,
the acceleration charts do not accurately represent the system response in this way and are
not used for analysis. Using velocity data only, the damping ratio was calculated to
be = 0.04 0.01, as show in Sample Calculations in the Appendix.
For future implementation of a control system, the first mode of the beam was analyzed. As
explained in more detail in the Theory section, the transfer function of the first mode was
created. Figure A4 represents the Simulink model that was used where the transfer
function has been calculated for the 1st mode. Figure 16 shows the FRF plot that has a
natural frequency of 7.60 Hz. This simulated frequency is 1.0 Hz lower than the
experimentally measured frequency. This shows that the transfer function is fairly accurate
in modeling the first mode. Figures 17 and 18 show the FRF phase diagram, highlighting
that the transient region of phase change is again at the frequency of the first mode (7.6 Hz)
for the simulated data. This again supports the accuracy of the model which can be used
later on to develop a controller to eliminate the first modal response of the cantilever
beam.

CONCLUSION
In this experiment a piezoelectric patch mounted on an aluminum cantilever beam was
stimulated with a linear sine chirp over a frequency range of 0 to 200 Hz. The vibration
outputs of the system measured as force, velocity, and acceleration were recorded and the
frequency characteristics of these signals were found using the Fast Fourier Transform
algorithm. The frequency response functions were calculated and used to find the natural
frequencies and damping ratio of the system. The resonance frequencies were found to be
1 = 7.7 0.3 , 2 = 46.0 0.4 , and 3 = 120 0.4 . The damping ratio was
calculated to be = 0.04 0.01. The first fundamental frequency and damping ratio were
used to model the system in Simulink. The simulation results were analyzed to find a
fundamental frequency of 7.6 Hz. This was compared to the measured resonance frequency
of 7.7Hz. This results in a percent error of 1.3% between the first resonance frequency of
the experimental and simulated results. Overall the simulated transfer function is a good
approximation of the cantilever and patch first modal response even though it ignores the

nonlinearities inherent to the real structure. This transfer function can therefore be used in
the future to intelligently design a controller to dampen the first modal response of the
system.

APPENDIX
GIVEN ADVANCED MODEL SIMULATION DATA

Figure A1: Bare aluminum beam without piezo patch natural frequencies

Figure A2: Aluminum beam with piezo match natural frequencies

SYSTEM PARAMETERS AND FLOW CHARTS


EQUIPMENT

MODEL

S/N

SENSITIVITY

Impedance Head Acceleration

PCB 288D01

772

98.2 mV/g

Impedance Head Force

PCB 288D01

772

98.58 mV/lbf

Laser Doppler Vibrometer

Polytec CLV-2534

10 mm/s/V

10
1
10

1
10

20
100

Figure A3: System Gain Flowchart

EQUATIONS AND SAMPLE CALCULATIONS


= =

2 1
2

(1)

= = 2 2
= = 2
= 7.7 .3
1 = 8.1 .2
2 = 7.44 .1
= .04 .01

SIMULINK MODELAND SIMULATION DATA FOR FUTURE CONTROL

Figure A4: Simulink Model of 1st Mode Transfer Function Response to Sine Chirp.
Figure A5: MATLAB code for analyzing experimental data, calculating parameters, and running
theoretical simulation.
%Script to Analyze experimental Data and Run Simulation to verify
%Experimental Data. Includes AD-HOC Analysis and Commented Notes
%%
clear
close all
%A=load('G6_exp2-001_cut.txt');
A=load('G6_exp2-002-cut.txt');
Time=A(:,1);
Chirp=A(:,5); % Chirp (piezo-Voltage) %input 1 (x1)
Transducer=A(:,3); % Base force %input 2 (x2)
Accelerometer=A(:,2); % Base accel %output 1 (y1)
LaserVib=A(:,4); % Tip vel %output 2 (y2)
Chirp=Chirp*200; %true voltage experienced by the PZT
Accel=Accelerometer*(10); %Acceleration in g
Force=Transducer*(1/.2216); %Force in N
Veloc=LaserVib*.1; %Velocity in m/sec (*.1)
figure(1);
plot(Time,Force);
title('Experimental Data: Force vs. Time');
xlabel('time(s)');
ylabel('Force (N)');
figure(2); %plot force, velocity, and acceleration in time domain
plot(Time,Force,Time,Veloc,Time,Accel);
legend('Force (N)','Velocity (m/sec)','Acceleration (g)');
title('Experimental Data: Force, Velocity, and Acceleration vs. Time');
xlabel('time(s)');
ylabel('Force (N), Acceleration (g), Velocity (m/sec)');

sf=400; %sampling frequency


n=40; %number of data blocks
[cvf,cvH1,cvH2,cvCOH,cvX,cvY,cvGYY]=FRFs_COH(Chirp,Veloc,sf,n);
[caf,caH1,caH2,caCOH,caX,caY,caGYY]=FRFs_COH(Chirp,Accel,sf,n);
[fvf,fvH1,fvH2,fvCOH,fvX,fvY,fvGYY]=FRFs_COH(Force,Veloc,sf,n);
[faf,faH1,faH2,faCOH,faX,faY,faGYY]=FRFs_COH(Force,Accel,sf,n);
figure(3); %plot Chirp-Velocity FRF Magnitudes
plot(cvf,abs(cvH1),cvf,abs(cvH2));
legend('H1','H2');
title('Experimental Data: Magnitude of Chirp-Velocity H1 and H2 vs.
Frequency');
xlabel('frequency (Hz)');
ylabel('m/sec /V');
figure(4); %plot Chirp-Velocity FRF Phases
plot(cvf,angle(cvH1),cvf,angle(cvH2));
legend('H1','H2');
title('Experimental Data: Phase of Chirp-Velocity H1 and H2 vs. Frequency');
xlabel('frequency (Hz)');
ylabel('Phase (radians)');
figure(5); %plot Chirp-Velocity Coherence
plot(cvf,abs(cvCOH));
title('Experimental Data: Coherence of Chirp-Velocity FRFs');
xlabel('frequency (Hz)');
ylabel('\gamma^2');
figure(6); %plot Chirp-Acceleration FRF Magnitudes
plot(caf,abs(caH1),caf,abs(caH2));
legend('H1','H2');
title('Experimental Data: Magnitude of Chirp-Acceleration H1 and H2 vs.
Frequency');
xlabel('frequency (Hz)');
ylabel('m/sec^2 /V');
figure(7); %plot Chirp-Acceleration FRF Phases
plot(caf,angle(caH1),caf,angle(caH2));
legend('H1','H2');
title('Experimental Data: Phase of Chirp-Acceleration H1 and H2 vs.
Frequency');
xlabel('frequency (Hz)');
ylabel('Phase (radians)');
figure(8); %plot Chirp-Acceleration Coherence
plot(caf,abs(caCOH));
title('Experimental Data: Coherence of Chirp-Acceleration FRFs');
xlabel('frequency (Hz)');
ylabel('\gamma^2');
%{
z=ones(length(cvf),1);
z=z.*(5.28/sqrt(2));
figure (9);
plot(fvf,abs(fvH1),fvf,abs(fvH2),cvf,z);
legend('H1','H2','intercept')
%}
figure(9); %plot Force-Velocity FRF Magnitudes
plot(fvf,abs(fvH1),fvf,abs(fvH2));
legend('H1','H2');
title('Experimental Data: Magnitude of Force-Velocity H1 and H2 vs.

Frequency');
xlabel('frequency (Hz)');
ylabel('m/sec /N');
figure(10); %plot Force-Velocity FRF Phases
plot(fvf,angle(fvH1),fvf,angle(fvH2));
legend('H1','H2');
title('Experimental Data: Phase of Force-Velocity H1 and H2 vs. Frequency');
xlabel('frequency (Hz)');
ylabel('Phase (radians)');
figure(11); %plot Force-Velocity Coherence
plot(fvf,abs(fvCOH));
title('Experimental Data: Coherence of Force-Velocity FRFs');
xlabel('frequency (Hz)');
ylabel('\gamma^2');
figure(12); %plot Force-Acceleration FRF Magnitudes
plot(faf,abs(faH1),faf,abs(faH2));
legend('H1','H2');
title('Experimental Data: Magnitude of Force-Acceleration H1 and H2 vs.
Frequency');
xlabel('frequency (Hz)');
ylabel('m/sec^2 /N');
figure(13); %plot Force-Acceleration FRF Phases
plot(faf,angle(faH1),faf,angle(faH2));
legend('H1','H2');
title('Experimental Data: Phase of Force-Acceleration H1 and H2 vs.
Frequency');
xlabel('frequency (Hz)');
ylabel('Phase (radians)');
figure(14); %plot Force-Acceleration Coherence
plot(faf,abs(faCOH));
title('Experimental Data: Coherence of Force-Acceleration FRFs');
xlabel('frequency (Hz)');
ylabel('\gamma^2');
%figure(15);
%plot(caf,abs(caH1),'r-',caf,abs(caH2),'k-',faf,abs(faH1),'g',faf,abs(faH2),'b-');
%xlim([5,200])
%plot(cvf,abs(cvH1),'r-',cvf,abs(cvH2),'k-',fvf,abs(fvH1),'g',fvf,abs(fvGYY),'b-');
%% SIMULATION
sim('StrainOutputModel');
SimTime=StrainOut.time;
SimPiezo=PiezoVoltageIn.data;
SimStrain=StrainOut.data;
a=1; %number of data blocks
[simf,simH1,simH2,simCOH,simX,simY,simGYY]=FRFs_COH(SimPiezo,SimStrain,sf,a);
figure(16); %plot SIMULATION Chirp-Strain FRF Magnitudes
plot(simf,abs(simH1),simf,abs(simH2));
legend('H1','H2');
title('Simulation Data: Magnitude of Chirp-Strain H1 and H2 vs. Frequency');
xlabel('frequency (Hz)');

ylabel('Strain/Voltage');
figure(17); %plot SIMULATION Chirp-Strain FRF Phases
plot(simf,angle(simH1),simf,angle(simH2));
legend('H1','H2');
title('Simulation Data: Phase of Chirp-Strain H1 and H2 vs. Frequency');
xlabel('frequency (Hz)');
ylabel('Phase (radians)');

function [f,H1,H2,COH,X,Y,GYY]=FRFs_COH(x,y,sf,n)
% Eric Holtzman -- adapted from "H1_H2_COH.m" by Troy Lundstrom
% Northeastern University
% 03/28/2015
%
%
%
%
%

Function to compute FRFs using input signal (x), output signal


(y), sampling frequency (sg) and the number of averages (n). The x and y
signals must be the same length with a uniform sampling frequency. Both x
and y should be in column vector form. Hanning window applied to input
and output data prior to FFT calculations.

% Calculate data increment quanitity, establish data block size and


% establish frequency vector and make sure each block is odd
Length=size(x(1:end,1),1); %Take length of input Data
blk_size=(floor(Length/(n))); %Divide input data into blocks
blk_size=blk_size-mod(blk_size-1,2); %Make blocks odd
f=linspace(-sf/2,sf/2,blk_size)'; %establish frequency vector
% Determine the index of the zero frequency
zeroind=find(f == median(f));
% Apply window to each block, calculate FFT and power spectra
win=hann(blk_size); %hann %flattopwin
for i=1:n;
% FFT of input
X(:,i)=fftshift(fft(win.*x(blk_size*(i-1)+1:blk_size*i,1)));
% FFT of output
Y(:,i)=fftshift(fft(win.*y(blk_size*(i-1)+1:blk_size*i,1)));
% Input-output crosspower spectra for each data block
GXY(:,i)=X(:,i).*conj(Y(:,i));
% Output-input crosspower spectra for each data block
GYX(:,i)=Y(:,i).*conj(X(:,i));
% Input autopower spectra for each data block
GXX(:,i)=X(:,i).*conj(X(:,i));
% Output autopower spectra for each data block
GYY(:,i)=Y(:,i).*conj(Y(:,i));
end
% Average crosspower and autopower spectra
GXY=mean(GXY,2);
GYX=mean(GYX,2);
GXX=mean(GXX,2);
GYY=mean(GYY,2);
% Calculate FRF
H1=GYX./GXX;
H2=GYY./GXY;
% Calculate Coherence
COH=H1./H2;

% Convert to one-sided spectrum


f=f(zeroind:end);
H1=H1(zeroind:end);
H2=H2(zeroind:end);
COH=COH(zeroind:end);
GYY=GYY(zeroind:end);
X=X(zeroind:end,1);
Y=Y(zeroind:end,1);

Das könnte Ihnen auch gefallen