Taking us through the math on the fourier transform of a Gaussian (Bell-shaped)
function:
Below, the sinusC ie sinus_cardinale function, which is what the square signal
transforms to:
Here, the gausian function transforms to another gaussian function. From Matlab:
from Meta ai:
Here's the updated code with normalization:
Matlab
% Define the function f(t)
t_start =-40;% start time
t_end =40;% end time
dt =0.01;% time step
t = t_start:dt:t_end;% time axis% Define f(t)
f =exp(-t.^2);% Gaussian function% Normalize f(t) to have unit energy
f = f ./sqrt(sum(f.^2)*dt);% Compute Fourier Transform using FFT
F =fftshift(fft(f));% Compute frequencies corresponding to F
w =(2*pi)/(dt*length(t))*(-length(t)/2:length(t)/2-1);% Normalize Fourier Transform to have unit energy
F = F ./sqrt(sum(abs(F).^2));% Plot time-domain function
figure;plot(t, f);xlabel('t (s)');ylabel('f(t)');title('Normalized Time-Domain Function f(t)');% Plot Fourier Transform
figure;plot(w,abs(F));xlabel('\omega (rad/s)');ylabel('|F(\omega)|');title('Normalized Fourier Transform of f(t)');% Optional: Plot phase spectrum
figure;plot(w,angle(F));xlabel('\omega (rad/s)');ylabel('Phase of F(\omega)');title('Phase Spectrum of F(\omega)');
Changes:
Normalized f(t) to have unit energy using f = f ./ sqrt(sum(f.^2)*dt).
Normalized F(ω) to have unit energy using F = F ./ sqrt(sum(abs(F).^2)).
Now, the energy of f(t) and F(ω) will be:
Matlab
% Verify unit energydisp('Energy of f(t):');disp(sum(f.^2)*dt);disp('Energy of F(ω):');disp(sum(abs(F).^2));
This should output:
Energy of f(t):
1
Energy of F(ω):
1
Indicating that both f(t) and F(ω) have unit energy.
No comments:
Post a Comment