It is likely your fft size is the cause. You need avoid power smearing around bins by having exact cycles. Or apply window but is less accurate.To determine the response of the fft to a sinusoidal of increasing
frequency yet same amplitude of 1.
I used a pure sine wave sin(2*pi*t*a) , where the multiplier 'a'
determines the period , and hence frequency of the wave.
Now examining the fft, the peak does indeed shift as expected,
the amplitude however doesn't quite behave as expected.
For a pure sine , in the analog world, the Fourier Transform doesn't
change amplitude with frequency .
The fft amplitude almost follows the equation 0.5-0.4*(w^1.8).
What is the actual relationship ?
Thank you for your answer.It is likely your fft size is the cause. You need avoid power smearing around bins by having exact cycles. Or apply window but is less accurate.
The easiest way is to use iFFT to generate the frequencies.Thank you for your answer.
If I use a particular length fft, not necessarily radix 2, will this correct the situation ?
So that everyone comprehends what I did, here are some details:
ω0 = 50
f1(t,x) = sin(ω0*2*pi*t*x)
N=1024 number of points
x = 1 to 18 , step 1
frequency range is then 0 to approximately 900 Hz
abs(fft) values, red multiplier character .
Curve fitting g1(x) = 0.5 - 0.42*(x/820)^1.8 , the blue line .
And, maybe, an image file; freq_shift.png
If there's a general formula to correct for this, without
adjusting the size of the fft all the time, then that is preferable
and likely useful.
I used maxima computer algebra system to examine this.Why not showing the Matlab code?
That's an interesting approach and one I haven't investigated.The easiest way is to use iFFT to generate the frequencies.
You decide which bins are populated, the rest of bins at zeros. Then apply iFFT. By this method you should get same amplitude provided the bin value is same. For example:
x = zeros(1,1024);
x(46) = 1;
y=real(ifft(x));
you can scale it at input to ifft. ifft scaling is arbitrary and may pass unity power.That's an interesting approach and one I haven't investigated.
From the ifft the time domain amplitudes should be amplitude adjusted.
If I apply the fft toyou can scale it at input to ifft. ifft scaling is arbitrary and may pass unity power.
so scale up (x) as you want output to be:
x = zeros(1,1024);
x(87) = 2^15;
y=real(ifft(x));
Let us experiment with two frequencies y1,y2:If I apply the fft to
sin(t*2*%pi*f)
where f, the frequency, is an integer, and n equals
the number of samples, then the peaks in the frequency
domain appear at f+1 and n+1-f and the absolute amplitude is
always 0.5.
If f isn't an integer, then the peaks are 'smeared out' and
the only way I presently know to correct the amplitude, is
by dividing by the curve that I previously fitted.
Perhaps you can illustrate more succintly how you apply
frequency binning.
x = zeros(1,1024);
x(87) = 2^15;
y1=real(ifft(x));
x = zeros(1,1024);
x(118) = 2^15;
y2=real(ifft(x));
%Now check fft of y1 and y2
plot(abs(fft(y1)));hold
plot(abs(fft(y2)));
That's a little unexpected, two peaks appear for abs(fft(y1)) and abs(fft(y2)).Let us experiment with two frequencies y1,y2:
x = zeros(1,1024);
x(87) = 2^15;
y1=real(ifft(x));
x = zeros(1,1024);
x(118) = 2^15;
y2=real(ifft(x));
%Now check fft of y1 and y2
plot(abs(fft(y1)));hold
plot(abs(fft(y2)));
or check time domain of y1,y2
I displayed two tones one y1, one y2 on same plot to show they are at same amplitudeThat's a little unexpected, two peaks appear for abs(fft(y1)) and abs(fft(y2)).
Are these the correct sign and imaginary or not though ?
I used two separate pI displayed two tones one y1, one y2 on same plot to show they are at same amplitude
Since they are real only they get mirrored mirrored
n=4096
ω0=floor(n/20)
f2(t,x)=cos(x*%pi*0.1)*sin(ω0*2*%pi*t*x)
m=floor(ω0/10)
your (x) input? what does it look like? what is sampling rate?This is what I've done so far for simultaneous
amplitude and frequency modulation .
It involves the sum of frequency shifted sinusoids,
x dependent amplitude modulation and zero extension.
Perhaps your approach has a place within this
scheme.
Where the function, floor, is similar to getting
the integer .
n=4096
ω0=floor(n/20)
f2(t,x)=cos(x*%pi*0.1)*sin(ω0*2*%pi*t*x)
m=floor(ω0/10)
Sum f2(t,x) across a domain of x, [0,m*0.5] in this instance .
eq=sum(f2(t,0.5*x ),x,1,m)
let f1(t) = previous
define(f1(t),eq)
Taking the fft(f1(t)) then using the plot of abs() values
I obtained
The outline of the time domain cosine function is apparent in the frequency
domain, as for the sign , I haven't bothered seeing how that might be found.
There is a limitation upon the resolution and other methods, unknown to me
at this stage, are required.
The input signal 'x' has a lot of what appear initially to be repetitions.View attachment 181093
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?