How to find MSE for different number of iterations when i have an audio signal
28 views (last 30 days)
Show older comments
I have an audio signal x with dimension 435200x2. I have to find the MSE between this signal and another audio signal of the same dimension for a number of iterations equal to 1000. How can i find it when i have large signals like in this case?
0 Comments
Answers (1)
Sourav Bairagya
on 21 Aug 2019
To calculate Mean Squared Error (MSE) between the two signals, first you have to calculate the difference between the two signals i.e. error signal.
Then, calculate the element wise square of this error signal to get Squared Error.
Now, calculate mean of the Squared Error over all its elements using “mean” function to get the desired MSE.
Write this whole method inside a function named “calMSE” and add this to your path.
function MSE = calMSE(t1,t2)
error = t1-t2; %Error between two signal
sqrd_err = error.^2; %Taking element wise sum of the error vector
MSE = mean(sqrd_err,'all'); %use ‘all’ in mean function to mean over all the elements of
% squared error signal
end
Now you can use this function as follows:
t1 = rand(435200,2); %Creating an random signal of dimension 435200X2
t2 = rand(435200,2); %Creating another random signal of dimension 435200X2
MSE = calMSE(t1,t2); %Call calMSE function to calculate MSE between t1 & t2
Now, use this function “calMSE” inside a for loop to calculate MSE between two input signals for desired number of iterations.
0 Comments
See Also
Categories
Find more on Audio I/O and Waveform Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!