Sunteți pe pagina 1din 25

Project 2

VIBRATION CHARACTERIZATION OF A CANTILEVERED


FLEXIBLE BEAM

CHRISTOPHER BALINO
CHRISTOPHER BRENNAN
SAM GREEN
ERIC HOLTZMAN
OLIVER QUADROS


Mechatronic Systems
Northeastern University














April 14, 2015
TABLEOFCONTENTS
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 .............................................................................. 20
Simulink And Matlab Code ................................................................................................. 20
Simscape Model ......................................................... Error! Bookmark not defined.














ABSTRACT
Microcantilevers, or small, projecting beams fixed only at one end, can be incorporated into
microelectromechanical 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 the first three modal
frequencies of a cantilever for comparison against a previously derived 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 natural frequency locations of the system. From this
model, the first three modes were expected to occur at f1= 9.475 Hz, f2=56.74 Hz, and f3=
152.7 Hz 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 frequency response functions for the cantilever were calculated and
the first three modal frequencies of the system were found to occur at f1= 7.70.3 Hz,
f2=46.00.4 Hz, and f3= 1200.4 Hz respectively. The discrepancies between the
experimental and theoretical results can be attributed to energy loss from unmodeled
system dynamics 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 infraction, and glucose
monitoring by using highly sensitive miniaturized biochips based on an array of micro and
nanocantilevers2.

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
controllercouldhavelittletonoeffectontheresponseoractuallyworsentheresponseofthe
system.

Thisexperimentdealswiththecharacterizationofathincantileverbeamfixedatoneendwith
apiezoelectric(PZT)patchnearthefixedend,andaPolytecLaserDopplerVibrometeraimedat
thefreehangingendtocollectvelocitydataatthetip.Thecollecteddatawasthenprocessed
usingaFastFourierTransform(FFT)inordertoconvertthisdatafromthetimedomaintothe
frequencydomain(whichisnecessarytodeterminetheresonancefrequencies).Thedatacan
then be used to calculate the autopower spectrum for both the inputs (force and piezo
voltage) and outputs (velocity and acceleration). Frequency response functions (FRFs) are
computed from the power spectrum data, and the resonance frequencies can be found
graphicallyfromtheseFRFs.








1Sader J. E., Chon, J. W. M., and Mulvaney, P., Calibration of rectangular atomic force microscope

cantilevers. Rev. Sci. Instrum. 70, 3967 (1999).


2 Vashist, S. K., A Review of Microcantilevers for Sensing Applications. Nanotechnol. Online, 3, 1. (2007).
PARAMETER SYMBOL VALUE AND UNITS
DENSITY 2700 /
YOUNGS MODULUS 69 10
LENGTH 244.5
WIDTH 25.4
THICKNESS 0.6
AREA MOMENT OF INERTIA FOR

RECTANGULAR CROSS SECTION 12
Experimental 1st Modal Frequency f1 7.70.3 Hz
Experimental 2nd Modal Frequency f2 46.00.4 Hz
Experimental 3rd Modal Frequency f3 1200.4 Hz
1st Mode Damping Ratio . 04 .01
Experimental 1st Modal Frequency n 2 7.7 .3 (rads)
Experimental 2nd Modal Frequency 1 2 8.1 .2 (rads)
Experimental 3rd Modal Frequency 2 2 7.44 .1 (rads)
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 microcantileverbased 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 as a
function of time and one or more spatial variables3. For reference, a diagram of the
theoretical model is depicted in Figure 1 with thickness t, width W and length L given as
dimensions for the piezo patch and beam respectively.


3 Bilbao, Stefan and Julius O. Smith. DiscreteTime Lumped Models. Center for Computer Research in Music

and Acoustics (CCRMA). Stanford University, (2014).









z

Beam x
L

Piezo
t b

W
t p
W
Lp

Figure 1: Diagram of 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 boundary
value problems4. 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

, , (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 equilibrium5. 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

4 J. Chaskalovic, Finite Elements Methods for Engineering Sciences, Springer Verlag, (2008).
5 Torby, Bruce. "Energy Methods". Advanced Dynamics for Engineers. HRW Series in Mechanical Engineering.

United States of America: CBS College, (1984).


0 (2)

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

0 (3)

and

0 (4)

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 conditions6.
These assumed mode shapes are solutions to the eigenvalue problem for the cantilever
beam and can be given as the following eigenfunctions:
sin cos sinh cosh (5)
and
sin cos sinh cosh (6)

where 1 and 2 are eigenfunction constants and A1D2 are eigenfunction coefficients. Note
that the values of the eigenfunction coefficients depend on the given boundary conditions,
yet the eigenfunction constants are independent of these conditions since they relate to the
natural frequencies of the system7. From here, 2 can be written in terms of 1 as
/

(7)

which gives the relation between natural frequency (Hz) and the 1 values as
/

(8)

Through orthonormalization of the discontinuous cantilever, the eigenvalue problem can


be solved for the multidegreeoffreedom system given by
(9)
thus yielding the eigenvectors x1 and x2, which can be put into state space as according to:


6 Tribology Group. Rotordynamics Laboratory. Texas A&M Univerisity. (2015).
7 Gere, J. M. and Timoshenko, S. P., 1997, Mechanics of Materials, PWS Publishing Company. (2011).
0 1
(10.1)

0
(10.2)

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

(11)

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

2 (12)

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, , 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 0200 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. 13 through 16 as given below:

(13)

(14)

(15)

(16)

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. 17 and Eq. 18 below:


8 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).
(17)

(18)

The coherence was then determined with Eq. 19 below:

(19)

The frequency response functions were used to determine the resonance frequencies of the
structure. Both and 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 halfpower bandwidth method around the
fundamental frequency.
The damping ratio is given by:

(20)

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

, (21)

Using Equation 21 and the 4 given values for , 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 12 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 2: Raw Force, Velocity, and Acceleration Data


Figure 3: One 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 crosspower spectra for piezovoltage and force inputs and velocity and
acceleration outputs. The calculated crosspower spectras were then averaged for all
blocks and used to calculate the Frequency Response Functions given by Eq. 17 and Eq. 18.
The frequency response functions were calculated for forcevelocity, forceacceleration,
piezovoltagevelocity, and piezovoltageacceleration.


Figure 4: Coherence of ChirpVelocity Data Figure 5: Coherence of ForceVelocity Data


Figure 6: Coherence of ChirpAccel. Data Figure 7: Coherence of ForceAccel. Data

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


Figure 8: ChirpVelocity FRF Magnitudes


Figure 9: ForceVelocity FRF Magnitudes

Figure 10 ChirpAcceleration FRF Magnitudes


Figure 11 ForceAcceleration 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 12 ChirpVelocity FRF Phase


Figure 13 ForceVelocity FRF Phase

Figure 14 ChirpAcceleration FRF Phase


Figure 15 ForceAcceleration FRF Phase

The chirpvelocity and forcevelocity FRF magnitudes (shown in Figures 8 and 9) 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 was located below the base of the cantilever beam. The resonance frequencies were
found to be 7.7 0.3 , 46.0 0.4 , and 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 17 displays the FRF phases of the first mode system and Figure
18 shows 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 16: FRF Plot for Simulink Simulation for 1st Mode Transfer Function


Figure 17: FRF 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 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 21. 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 allowing the first 3 modes of the beam to be
captured. The natural frequencies were found experimentally to be 7.7 0.3 ,
46.0 0.4 , and 120 0.4 as visible in Figure 8. It is clear that the
experimental frequencies found are lower than those mathematically expected. This is to
be expected as any fully nonrigid parts or loss of energy would change the reaction of the
system. Also, the addition of a piezo patch, 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 piezo patch, 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 47 represent the coherence plots of the four different FRF data sets. Initially at
very low frequencies, the coherences of all plots are low. However, at ranges greater than
40 Hz the coherence of all plots is 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 ChirpVelocity and ForceVelocity FRF plots
(Figures 8 and 9) 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 0.10 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
7.7 0.3 , 46.0 0.4 , and 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
GIVENADVANCEDMODELSIMULATIONDATA


Figure A1: Bare aluminum beam without piezo patch natural frequencies


Figure A2: Aluminum beam with piezo match natural frequencies

SYSTEMPARAMETERSANDFLOWCHARTS
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 CLV2534 10 mm/s/V

10
1 1

10 10

20
100


Figure A3: System Gain Flowchart

EQUATIONSANDSAMPLECALCULATIONS
(A1)

2 (A2)
2 (A3)
2 7.7 .3 (A4.1)
2 8.1 .2 (A4.2)
2 7.44 .1 (A4.3)
.04 .01 (A4.4)

SIMULINKMODELANDSIMULATIONDATAFORFUTURECONTROL


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);

S-ar putea să vă placă și