How to measure similarity between FRFs in MATLAB
30 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Abo
am 6 Okt. 2025 um 7:10
Kommentiert: Mathieu NOE
am 8 Okt. 2025 um 8:53
Hi everyone,
I have two FRF datasets.
What’s the best MATLAB method to measure their similarity?
Thanks!
0 Kommentare
Akzeptierte Antwort
Mathieu NOE
am 6 Okt. 2025 um 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))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function coeff=corrcoeff(u,v)
coeff=max(xcorr(u,v))/norm(u)/norm(v);
end
0 Kommentare
Weitere Antworten (2)
William Rose
am 6 Okt. 2025 um 13:19
Bearbeitet: William Rose
am 7 Okt. 2025 um 17:01
@Abo,
[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 Kommentar
William Rose
am 6 Okt. 2025 um 13:40
@Abo,
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.

Siehe auch
Kategorien
Mehr zu Vibration Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!