How to find MSE for different number of iterations when i have an audio signal
26 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Sourav Bairagya
2019-8-21
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!