Skip to main content

Fourier Differentiation Property in MATLAB

 

Fourier Differentiation Property

The Fourier transform of a time-domain signal is defined as follows
 

Fourier Differentiation Property

 

MATLAB Code for Fourier Differentiation property of a Sine Function

clc;
clear;
close all;
 
% Parameters
fs = 1000; % Sampling frequency (Hz)
T = 1; % Duration of the signal (seconds)
f = 50; % Frequency of the sine wave (Hz)
A = 1; % Amplitude of the sine wave

% Time vector
t = 0:1/fs:T-1/fs;

% Generate sine wave
x = A * sin(2*pi*f*t);

% Compute Fourier Transform
X = fft(x);

% Frequency vector
N = length(x);
frequencies = (0:N-1)*(fs/N);

% Apply differentiation property in frequency domain
jw = 1i * 2 * pi * frequencies; % jω term for differentiation

% Multiply Fourier coefficients by jω
dX = jw .* X;

% Compute Inverse Fourier Transform for differentiated signal
dx = ifft(dX);

% Plotting
figure;

% Plot original signal and its magnitude spectrum
subplot(3,1,1);
plot(t, x);
title('Original Sine Wave');
xlabel('Time (s)');
ylabel('Amplitude');

subplot(3,1,2);
plot(frequencies, abs(X));
title('Magnitude of Fourier Transform (Original)');
xlabel('Frequency (Hz)');
ylabel('Magnitude');

% Plot differentiated signal and its magnitude spectrum
subplot(3,1,3);
plot(t, real(dx));
title('Differentiated Signal');
xlabel('Time (s)');
ylabel('Amplitude');

% Compute Fourier Transform of differentiated signal
dX_fft = fft(dx);

% Plot magnitude spectrum of differentiated signal
figure;
plot(frequencies, abs(dX_fft));
title('Magnitude of Fourier Transform (Differentiated)');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
 

Output

 
 
 
 

 

Copy the MATLAB Code from here

 

MATLAB Script (for a Gaussian function)

clc;
clear;
close all;

% Parameters
N = 256; % Number of samples
T = 1; % Total duration (s)
t = linspace(0, T, N); % Time vector
mean_val = 0.5 * T; % Mean of the Gaussian
std_dev = 0.1 * T; % Standard deviation of the Gaussian

% Gaussian signal
signal = exp(-0.5 * ((t - mean_val) / std_dev) .^ 2);

% Fourier Transform
Xomega = fft(signal);

% Frequencies
frequencies = (0:N-1) * (1/T);

% Apply Fourier Differentiation Property
omega = 2 * pi * frequencies;
jOmegaXomega = 1i * omega .* Xomega;

% Magnitude of the output signal in the frequency domain
output_magnitude = abs(jOmegaXomega);

% Plot input signal in time domain
figure;
subplot(2, 1, 1);
plot(t, signal, 'LineWidth', 1.5);
title('Input Gaussian Signal');
xlabel('Time (s)');
ylabel('Amplitude');

% Plot output signal in frequency domain
subplot(2, 1, 2);
plot(frequencies, output_magnitude, 'LineWidth', 1.5);
title('Output Signal |j\omega X(\omega)| in Frequency Domain');
xlabel('Frequency (Hz)');
ylabel('Magnitude'); 

 

Output 




Copy the MATLAB Code from here

 

 

Another Example

 clc;
clear;
close all;

% Main Script

% Example input signal x(t)
signal = [1, 2, 3, 4];

% Compute Fourier Transform and apply differentiation property
[Xomega, frequencies] = fourierTransform(signal);
jOmegaXomega = applyDifferentiationProperty(Xomega, frequencies);

% Prepare data for input signal plot
inputSignalX = 0:length(signal)-1;
inputSignalY = signal;

% Prepare data for output signal plot
outputSignalX = frequencies;
outputSignalY = abs(jOmegaXomega);

% Plot input signal
figure;
subplot(2, 1, 1);
plot(inputSignalX, inputSignalY, 'LineWidth', 1.5);
title('Input Signal x(t)');
xlabel('Index');
ylabel('Amplitude');

% Plot output signal
subplot(2, 1, 2);
plot(outputSignalX, outputSignalY, 'LineWidth', 1.5);
title('Output Signal after Applying Fourier Transform Differentiation Property');
xlabel('Frequency (\omega)');
ylabel('Magnitude');

% Function Definitions

% Compute Fourier Transform of input signal x(t)
function [Xomega, frequencies] = fourierTransform(xt)
    N = length(xt);
    Xomega = fft(xt);  % Using inbuilt fft function
    frequencies = 2 * pi * (0:N-1) / N;
end

% Differentiation property in frequency domain: F(dx(t)/dt) = jω X(ω)
function differentiated = applyDifferentiationProperty(Xomega, frequencies)
    differentiated = complex(zeros(1, length(Xomega)));
    for k = 1:length(Xomega)
        omega = frequencies(k);
        differentiated(k) = 1i * omega * Xomega(k);
    end
end
 

Output 

 

 

Copy the MATLAB Code from here

 

 

Also read about

[1] FFT Magnitude and Phase Spectrum using MATLAB

People are good at skipping over material they already know!

View Related Topics to







Contact Us

Name

Email *

Message *