MATLAB Answers

removal of frequency from 0-200HZ

3 views (last 30 days)
imran khan
imran khan on 25 Sep 2019
Commented: imran khan on 25 Sep 2019
I am removing frequecy from( 0-200)HZ from FFT spectrum and then i have taken IFFT of signal to see complete spectrum in time domain.To watch complete spectrum in time domain of signal i have removed frequency from (-200 to 200)HZ.I am not sure i did right or wrong.If anyone knows then please help me.Thanks in advance.
clc,close all,clear all
codn=70;
% fc=6e+3;
fs=36000;
bode=1000;
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
fs = 36000;
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 signal')
xlabel('time');
ylabel('amplitude')
ylim([-1 1.5])
timedomain.jpg
y = fftshift(fft(x2)/N);
figure(2)
plot(fvec,abs(y))
xlabel('frequency');
ylabel('amplitude')
fft.jpg
figure(3)
z=y;
z(fvec>=-200 & fvec<=200)=0
plot(fvec,abs(z))
xlabel('frequency removed from -200 to 200 HZ due to symmetry of signal');
ylabel('amplitude')
removedfrequency.jpg
figure(4)
zf=fftshift(z)*N
zifft=ifft(zf)+.5
plot(tvec,abs(zifft))
xlabel('time');
ylabel('amplitude')
IFFT.jpg

  0 Comments

Sign in to comment.

Answers (1)

Matthias Witkowski
Matthias Witkowski on 25 Sep 2019
It is not recommendable to zero fft bins as this corresponds to a convolution with a sinc function in time domain, this will introduce unwanted behavior in your time domain signal. You should rather use a high pass filter in your case.

  1 Comment

imran khan
imran khan on 25 Sep 2019
Dearr Matthias Witkowski,
My task is to just reomove frequency from 0-200 HZ because i am going to generate LOW RATE ARBITERSRY WAVEFORM FOR VISIBLE LIGHT COMMUNICASTION,I know that there will be unwanted noise in time domain after removing frequency,but my task is to check please that my all process which i did is right or wrong.Especially in time domain is ok? i mean complete spectrum is shown or not?
Best regards,
Imran Khan.

Sign in to comment.

Sign in to answer this question.