Understanding SNR matlab syntax
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I'm trying to determine the SNR for a noisy set of data - my data is actually trajectory data (x, y, z) measuring motion. I've attached a mat file (Traj.mat) containing two variables - the first variable is noisy trajectory data (pos_noise) and the second is relatively clean (pos_clean) showing some motion although there is still some noise superimposed on the signal.
Visually, I can tell the two datasets apart but I'm trying to quantify the level of noise in each dataset to described its quality.
So I'm looking at the SNR - the problem is that I don't really have a reference noise signal in this case but I noticed the following syntax in the matlab help files for snr: r = snr(x) and when I use this on my datasets, I appear to get a positive, large magnitude value for my cleaner dataset and generally negative value, lower magnitude for my noisy dataset. What does this mean? Is it the correct way to use this function as I always thought you need a reference noise signal to estimate the SNR.
Using just snr(x) gives me a plot of the spectrum and again, what I notice is that the spectrum (fundamental frequencies etc) of the noisy signal is generally below zero while the spectrum for the cleaner signal is above zero - again, I don't quite understand what this means.
I did wonder if I can estimate the noise in the signal by looking at its spectrum - I used the signal analyser app to compare the z-trajectories of the clean and noise data (see attached pic - left panel noisy data, right panel cleaner data) but I'm not sure how to extract it or whether it is possible to do so.
Thank you for your help in advance!
2 commentaires
Shekh Md Mahmudul Islam
le 30 Oct 2020
Similar things I also wondered before what really mean by snr function of matlab?
Réponses (1)
Mathieu NOE
le 30 Oct 2020
hi
I agree that without a "clean" reference signal , the built in snr function of matlab is of little help
so I decided to do it my way - see code attached
There is only one thing to decide , the frequency range that you estimate for your "clean" (useful signal) data
according to what you provided , I decided that above fc = 0.25 (normalised freq) you have only the noise floor. I extrapolated the same psd of noise for the freq range where you have the useful signal so the computation of the power ratio is doable
I got roughly 10 dB SNR whatever I choose for fc between 0.1 and 0.3. So the cut off frequency choice is not that critical. The spectrum plot should be there to help you decide where to put the cursor
hope it helps
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!