Noisy Waveform Restoration using DFT in MATLAB
Code:
clc
clear
all
close
all
t=0:0.01:2*pi;
x=sin(t)+sin(2*t);
subplot(2,2,1);
plot(t,x);
title('Original signal');
xlabel('Time');
ylabel('Amplitude');
n=rand(1,length(t));
x=x+n;
subplot(2,2,2);
plot(t,x);
title('Noise corrupted signal');
xlabel('Time');
ylabel('Amplitude');
g=fft(x);
subplot(2,2,3);
plot(abs(g));
title('Magnitude part of fft');
f=find(abs(g)<50);
g(f)=zeros(size(f));
w=ifft(g);
subplot(2,2,4);
plot(w);
title('Signal after noise removal');
xlabel('Time');
ylabel('Amplitude');
No comments