Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Dear fellows i am working on visible light communication and i removed frequency in the range of 3-200 HZ becuase of noise .Will you please do some modification in my code so that in last figure in time domain i use filter which does not remove noi

1 回表示 (過去 30 日間)
imran khan
imran khan 2019 年 10 月 22 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
clc,close all,clear all
codn=70;
% fc=6e+3;
fs=3600;
bode=10;
code=round(rand(1,codn));
code_len=round(1/bode/(1/fs))
for ii=1:codn
x((ii-1)*code_len+1:code_len*ii)=code(ii);
end
x2 = x-(1/2) % get rid of most of the dc peak
% set up time and frequency arrays
N = length(x);
delt = 1/fs;
delf = fs/N
tvec = (1:N)*delt
fvec = (-N/2:N/2-1)*delf ; % shifted frequency array
figure(1)
plot(tvec,x2(1,:)+0.5)
title('orignal baseband')
xlabel('time');
ylabel('amplitude')
ylim([-1 1.5]);
y = fftshift(fft(x2)/N);
z=abs(y);
figure(2)
plot(fvec,abs(y))
title('FFT')
xlabel('frequency')
ylabel('amplitude')
figure(3)
z=y;
z(abs(fvec)>=3 & abs(fvec)<=200)=0
plot(fvec,abs(z))
xlabel('frequency removed from 3 to 200 HZ');
ylabel('amplitude')
figure(4)
zf=fftshift(z)*N;
zifft=ifft(zf)+0.5
plot(tvec,abs(zifft))
ylim([-1 1.5])
title('recovered signal')
xlabel('time');
ylabel('amplitude')
figure(5)
x2 = medfilt1(abs(zifft),70); % Filter with median filter
plot(tvec,x2)
title('Filtered Signal with median filter ')
xlabel('time ');
ylabel('amplitude ')
ylim([-1 1.5]);
  5 件のコメント
Daniel M
Daniel M 2019 年 10 月 22 日
編集済み: Daniel M 2019 年 10 月 22 日
No it's not clear. You're saying you want to remove noise from the signal in the plot "Filtered signal with median filter"? Can you indicate what you consider the noise to be in this signal? Looks pretty clean to me.
Also, and I've told you this before, it should be
zf=ifftshift(z)*N;
I've also asked you this before, but what do you want to do with the values of x outside of [0 1] range? Some suggestions: 1) clip values to the value at the boundary 2) take the reflection of the values about the boundary (like an absolute value) 3) normalize x to be within 0 and 1
And please post code using the "code" button so it is easier to read as well as copy/paste.
imran khan
imran khan 2019 年 10 月 24 日
Dear i will tell you complete detail on tuesday

回答 (0 件)

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by