LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

mse(Mean squared error).vi

Solved!
Go to solution
Hello. I am a beginner to LabVIEW.
As shown in the figure below, I want to measure MSE from waveform data using MSE.VI, but there are many difficulties.
How can I get the X and Y values of MSE.VI input from waveform data?
I uploaded my VI file as an attachment.

캡처.PNG

0 Kudos
Message 1 of 7
(4,089 Views)

If you have two sequences, X and Y, you can compute the Mean Square Error between them.  For example, if you fit a straight line through a series of points, you can compute the MSE between the data and the corresponding point on the line that you tried to fit.  Indeed, one often tries to find the line that has the smallest MSE, and calls this the "Least Squares Fit line".  [I'm over-simplifying a little bit ...]

 

You took a Waveform and used it for both X and Y.  I would expect the MSE to always be 0, no matter what the Waveform was.  Is that what you got?

 

What is it that you are really trying to do?  What are X and Y going into the MSE function?  I suspect that you might not quite understand what you are doing (I certainly don't understand what you are doing ...).

 

Bob Schor

 

 

0 Kudos
Message 2 of 7
(4,065 Views)

Hi, Bob Schor

 

Thanks for the answer.

 

It is an object to construct an algorithm for removing noise using a wavelet transform on a signal measured by a microphone and analyzing a noise removal effect on a denoised signal.

 

The purpose of using Mse is to evaluate the accuracy of the noise removal process.

 

However, I don't know how to calculate Mse using Mse.VI.

 

How can I calculate MSE from denoised acoustic signals?

0 Kudos
Message 3 of 7
(4,042 Views)

@Disaster_prevention wrote:

The purpose of using Mse is to evaluate the accuracy of the noise removal process.


 

You simply need to compare the signal before and after the filter, so wire these signals to the two inputs of MSE. (You are currently comparing a waveform to itself, which makes no sense).

 

Besides the math, you are not really measuring any MSE this way, unless you can assume that the filtering removes 100% of the noise while creating zero distortion to the signal. That's typically only an approximation.

 

Notice all your red coercion dots, each one means that the datatype of the wired signal is not what the function expects. MSE wants two 1D arrays of equal size. (Personally, I would not have called the inputs X and Y, because that's confusing.)

 

Even if you are a beginner, I would recommend you get away from express VIs and dynamic data.

0 Kudos
Message 4 of 7
(4,035 Views)

Hi, altenbach

 

Corrected the red coercion dots according to your answer, and connected the signals before and after the filter to the two inputs of the MSE.

However, MSE is calculated as 0 as shown below.

 

How do I edit the block diagram?

 

Upload a work file as an attachment.

 

Thank you.

MSE_VI.PNGMSE result.PNG

0 Kudos
Message 5 of 7
(4,009 Views)
Solution
Accepted by topic author Disaster_prevention

Your SNR is less than 0.01, but your indicator is formatted to only show two decimal digits. Change the format and you get a nonzero value with your current data (right-click...display format...):

 

altenbach_0-1584432154884.png

 

I have not determined the validity of the rest of your code. In particular I don't know if your wavelet settings are reasonable. Do you know how a noiseless dataset is supposed to look like (e.g. from a simulation)?

 

0 Kudos
Message 6 of 7
(4,000 Views)

The present wavelet transform denoising process is a step to build, and the appropriate wavelet parameter is not yet applied.

 

I plan to analyze noise removal signal performance based on MSE and SNR in the future and determine the appropriate wavelet parameters.

0 Kudos
Message 7 of 7
(3,991 Views)