Showing results for 
Search instead for 
Did you mean: 

Verification of Labview progamm to calculate signal to noise ratio



i want to measure SNR of a simulated (or acquired) signal. For that, using two Harmonic-distortion-vi, i have extracted fundamental and residual signal from my simulated signal. Can you please check the attached vi and tell what i did in there is right or wrong?


Thank you.

Best Regards,


0 Kudos
Message 1 of 2

The easiest way to check if your code to analyze data "does the right thing" is to test the code by giving it a known input and seeing if it creates the expected output.  It should be easy to make a signal having a known S/N ratio, and "feed it" to your algorithm to see if you get the expected result.  Indeed, testing your software is the mark of a good developer.


Having written the above (without looking at your code), I decided to test this for myself.  I used the Simulate Signal Express VI (although I generally hate Express VIs) to generate a Sinusoid with Gaussian Noise, S/N 5, and passed the output through two other VIs to calculate a S/N ratio, getting back 5 (with some margin of error).


I then looked at your code.  Congratulations, you also generated Test Data and used it to test your algorithm.  So why do you need our advice?  Did you get the right answer?  If not, where do you think your code went astray?  Did you get a reasonable value for "Signal"?  For "Noise"?  Can you do a little more work of your own and come back with a more "focussed question"?  Trust me, it will be more of a "learning experience" for you to spend a little more time figuring this out ...


Bob Schor


0 Kudos
Message 2 of 2