How to measure similarity between FRFs in MATLAB

30 views (last 30 days)
Hi everyone,
I have two FRF datasets.
What’s the best MATLAB method to measure their similarity?
Thanks!

Accepted Answer

Mathieu NOE
Mathieu NOE on 6 Oct 2025 at 8:33
hello Abo
perhaps you could use correlation-based similarity?
visually there is quite a good match even though the curves differ in some frequency range.
I believe these curves are modal analysis curve ? of course , the quality of the measurement is critical here, so I would recommend to look at the coherence to (eventually) use only the "high" coherence data in the correlation factor computation (it easy to have mismatch of data when coherence is poor)
I used one for the modulus (in dB) and one for the phase
you could do the average of the two to have kind of global index (like I did)
load("TWO_FRFS.mat")
f1 = frfs(1).f; % frequency (Hz)
f2 = frfs(2).f; % frequency (Hz)
m1 = 20*log10(abs(frfs(1).H)); % gain modulus (in dB)
m2 = 20*log10(abs(frfs(2).H)); % gain modulus (in dB)
p1 = 180/pi*angle(frfs(1).H); % phase (in °)
p2 = 180/pi*angle(frfs(2).H); % phase (in °)
figure
subplot(2,1,1),hold on , grid on
plot(f1,m1)
plot(f2,m2)
xlabel('Frequency (Hz)')
ylabel('Gain Modulus (dB)')
subplot(2,1,2),hold on , grid on
plot(f1,p1)
plot(f2,p2)
xlabel('Frequency (Hz)')
ylabel('Phase (°)')
global_corrcoef = 0.5*(corrcoeff(m1,m2)+corrcoeff(p1,p2))
global_corrcoef = 0.7698
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function coeff=corrcoeff(u,v)
coeff=max(xcorr(u,v))/norm(u)/norm(v);
end

More Answers (2)

William Rose
William Rose on 6 Oct 2025 at 13:19
Edited: William Rose on 7 Oct 2025 at 17:01
[Edit: Change the formula for the normalized squared distance slightly: the change is to divide the squared distance by the sum of the variances, instead of dividing by the mean variance or by the larger variance. Rename this measure the "sum of normalized squared distance" (SNSD, instead of NSD).]
I like the answer from @Mathieu NOE. I always like and learn from his answers. Here is a diferent approach.
A quantitative measure of similarity (or actually, difference) is the sum of the normalized squared distances (in the complex plane) between the two FRFs, at corresponding frequencies. Let's assume the two FRFs are measured at the same frequencies. (If the FRFs are not measured at the same frequncies, then interpolate to a common set of frequencies, and ignore frequency ranges where the FRFs don't overlap.)
Define the sum normalized squared distance (SNSD) between two spectra as follows:
In the equation above, X and Y are the complex FRF estimates, and and are the estimated variance of the X and Y, at frequency .
If the spectra X and Y are the same, except for random measurement noise, then SNSD has a chi-squared distribution with 2N degrees of freedom, where N is the number of points compared. Of course, that assumes that certain conditions are true (independence, normality of the variability of the real and imaginary parts). But even if those conditions are not true, it's still a reasonable measure of difference. The low-coherence parts of the spectrum will have high variance, which means they will not count as much in the measure of difference. That is good, because it gives less weight to the noisy parts of the frequency response estimates.
The tricky part is estimating the variance of each FRF at each frequency.
Notes on transfer function estimation are attached.
I am also attaching a script, spectrumDifferenceTest.m, which demonstrates (by Monte Carlo simulation) that SNSD does in fact have a chi-squared distribution with 2N degrees of freedom, when the two spectra are the same except for random variation. It computes the SNSD for 1000 independent cases, using 100 points per spectrum in every case. The script shows that the mean and variance of SNSD have the expected values (2N and 4N respectively), and that the probability histogram of SNSD values is very similar to the probability density function of the chi squared distribution with 2N degrees of freedom (figure below). In this script, the variance of each FRF at each frequency is known. I should provide for you a formula to estimate the variance of the FRF estimate, at each frequency.
  1 Comment
William Rose
William Rose on 6 Oct 2025 at 13:40
I have not yet provided a formula for the variance, . I am traveling and do not have access to some resources. I hope to get that information tomorrow.

Sign in to comment.


Abo
Abo on 7 Oct 2025 at 18:26
Thanks everyone for the helpful answers! The shared methods really helped me understand how to compare FRFs.

Categories

Find more on Vibration Analysis in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!