views:

678

answers:

2

With a sine input, I tried to modify it's frequency cutting some lower frequencies in the spectrum, shifting the main frequency towards zero. As the signal is not fftshifted I tried to do that by eliminating some samples at the begin and at the end of the fft vector:

interval = 1;
samplingFrequency = 44100;
signalFrequency = 440;
sampleDuration = 1 / samplingFrequency;
timespan = 1 : sampleDuration : (1 + interval);
original = sin(2 * pi * signalFrequency * timespan);
fourierTransform = fft(original);
frequencyCut = 10; %% Hertz
frequencyCut = floor(frequencyCut * (length(pattern) / samplingFrequency) / 4); %% Samples
maxFrequency = length(fourierTransform) - (2 * frequencyCut);
signal = ifft(fourierTransform(frequencyCut + 1:maxFrequency), 'symmetric');

But it didn't work as expected. I also tried to remove the center part of the spectrum, but it wielded a higher frequency sine wave too.

How to make it right?

+1  A: 
las3rjock
cool example!
Jader Dias
+1  A: 
Amro
I read the question to mean that the poster wanted to reduce the absolute frequency of the signal, which could be done in a crude way by downsampling and zero-padding the spectrum, or could be done more precisely by shifting the desired portion of the spectrum. If you downsample the signal, you actually shift it up in frequency in the DFT's -pi to pi relative frequency axis (until you downsample too much and alias the signal).
las3rjock
After seeing your latest edit, I think the original poster needs to clarify whether he wants a low-pass-filtered version of the signal (like yours) or a frequency-downshifted version of the signal (like mine).
las3rjock
@las3rjock you're right, this signal was LPFized. But I still accept his answer for pointing me the resample method =)
Jader Dias
The Resample method resample arrays too, not only timestamp objects as I expected from what you said
Jader Dias
You must be talking about the one in Signal Processing toolbox
Amro