How to plot MSE for error signal and fft for my code?

10 views (last 30 days)
[s, f_s] = audioread('handel.wav');
noise= 0.2*cos(2*pi*(50/f_s)*(1:N));
d = s + noise;
figure(2);
plot(d);
L=20;
alpha=0.01;
delta=100;
[e,y,ff] = lms1_d(d,L,alpha,delta);
figure(3);
plot(e);
[c1x, c1y] = size(s);
[c2x, c2y] = size(d);
if c1x ~= c2x
disp('dimension do not agree');
else
R = c1x;
C = c1y;
err = sum((s - e).^2)/(R*C);
MSE = sqrt(err);
MAXVAL = 65535;
PSNR = 20*log10(MAXVAL/MSE);
disp(['mse=' num2str(MSE) ' PSNR=' num2str(PSNR)]);
end
  2 Comments
Geoff Hayes
Geoff Hayes on 17 Jan 2019
Priyanka - please explain/comment on what you are doing in the above code. Where is the FFT? What is the lms1_d?
Priyanka Shanmuga Raja
Priyanka Shanmuga Raja on 17 Jan 2019
Edited: Priyanka Shanmuga Raja on 17 Jan 2019
lms1_d is my function that i put as a seperate coding. I showed this codes and outputs to my professor, he asked me to plot MSE and fft.
I have given an input signal s " handel.wav" .
Generated a cosinusoidal signal with the frequency 50 Hz, the amplitude 0.3 and the phase 3π/4 as noise.
I have added s + noise
Now by using lms function, i have filtered the added error and plotted. Also calculated MSE, now i want to plot MSE and fft.

Sign in to comment.

Answers (0)

Categories

Find more on Fourier Analysis and Filtering 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!