calculate snr of digital signal

4 views (last 30 days)
uzmeed on 8 Nov 2019
Answered: uzmeed on 9 Nov 2019
Hi I have a data stream say
Its maximum is data_max and min is data _min
means that data_in may vry between data_max and data_min
I need to calculate the snr of the data
I am doing it like this
Am I correct ??

Answers (2)

Daniel M
Daniel M on 8 Nov 2019
This is not correct. The second input to snr must be a real-valued row or column vector that must have the same dimensions as the first input. It is the estimate of noise of your signal. You are entering a single number which is the range of amplitudes of your signal.
How are you quantifying noise? What does your signal look like? You may want to browse the examples on the document page for snr to see if you can get an estimate of the noise that way. Otherwise, you'll have to provide more information here, perhaps in the form of a figure showing the frequency spectrum of your signal.
  1 Comment
Daniel M
Daniel M on 8 Nov 2019
Also, you shouldn't name your variable diff as that overrides the native function diff. This is tricky for new users that don't know common MATLAB function names. If you're ever unsure, you can write
which <name>
where <name> is a variable you want to use, to check if it is the name of a function.

Sign in to comment.

uzmeed on 9 Nov 2019
Thanks Daniel
All my input are cloumn vectors data_in is a single colum vector
similarly diff again a column vector that I am getting subtracting two column vectors data_min and data_max
As far as quantification of noise is concerned
I have digital stream of data with an RMS value ( I consider it as the signal)
Then have the min max limit till where the data can vary ( I cosider it the range of noise)
Suppose if the data_in =x;
so I take 0.2x as noise, the diff of min max values
and calculate the snr as snr(data_in,diff)
Again thanks for guidance I will be carefull for assining variable
Best Regards


Community Treasure Hunt

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

Start Hunting!

Translated by