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







Admin & Author: Salim

s

  Website: www.salimwireless.com
  Interests: Signal Processing, Telecommunication, 5G Technology, Present & Future Wireless Technologies, Digital Signal Processing, Computer Networks, Millimeter Wave Band Channel, Web Development
  Seeking an opportunity in the Teaching or Electronics & Telecommunication domains.
  Possess M.Tech in Electronic Communication Systems.


Contact Us

Name

Email *

Message *

Popular Posts

Constellation Diagrams of ASK, PSK, and FSK

📘 Overview 🧮 Simulator for constellation diagrams of ASK, FSK, and PSK 🧮 Theory 🧮 MATLAB Codes 📚 Further Reading BASK (Binary ASK) Modulation: Transmits one of two signals: 0 or -√Eb, where Eb​ is the energy per bit. These signals represent binary 0 and 1.    BFSK (Binary FSK) Modulation: Transmits one of two signals: +√Eb​ ( On the y-axis, the phase shift of 90 degrees with respect to the x-axis, which is also termed phase offset ) or √Eb (on x-axis), where Eb​ is the energy per bit. These signals represent binary 0 and 1.  BPSK (Binary PSK) Modulation: Transmits one of two signals: +√Eb​ or -√Eb (they differ by 180 degree phase shift), where Eb​ is the energy per bit. These signals represent binary 0 and 1.    Simulator for BASK, BPSK, and BFSK Constellation Diagrams SNR (dB): 15 Add A...

Antenna Gain-Combining Methods - EGC, MRC, SC, and RMSGC

📘 Overview 🧮 Equal gain combining (EGC) 🧮 Maximum ratio combining (MRC) 🧮 Selective combining (SC) 🧮 Root mean square gain combining (RMSGC) 🧮 Zero-Forcing (ZF) Combining 🧮 MATLAB Code 📚 Further Reading  There are different antenna gain-combining methods. They are as follows. 1. Equal gain combining (EGC) 2. Maximum ratio combining (MRC) 3. Selective combining (SC) 4. Root mean square gain combining (RMSGC) 5. Zero-Forcing (ZF) Combining  1. Equal gain combining method We add the correlated data streams from different antennas in the equal gain combining method. Then we multiply the resultant data with (1/(number of antennas)) For example, for two antenna gain-combining  If the received symbols are y1 and y2, then  Equal combing gain, y_egc = 0.5 * (y1 + y2) 2. Maximum ratio combining method We multiply the individual data streams with weights in the maximum ratio combining method. More weightage is multipli...

BER vs SNR for M-ary QAM, M-ary PSK, QPSK, BPSK, ...

📘 Overview of BER and SNR 🧮 Simulator for m-ary QAM and m-ary PSK 🧮 MATLAB Codes 📚 Further Reading Modulation Constellation Diagrams BER vs. SNR BER vs SNR for M-QAM, M-PSK, QPSk, BPSK, ... What is Bit Error Rate (BER)? The abbreviation BER stands for bit error rate, which indicates how many corrupted bits are received (after the demodulation process) compared to the total number of bits sent in a communication process. It is defined as,  In mathematics, BER = (number of bits received in error / total number of transmitted bits)  On the other hand, SNR refers to the signal-to-noise power ratio. For ease of calculation, we commonly convert it to dB or decibels.   What is Signal the signal-to-noise ratio (SNR)? SNR = signal power/noise power (SNR is a ratio of signal power to noise power) SNR (in dB) = 10*log(signal power / noise power) [base 10] For instance,...

Comparisons among ASK, PSK, and FSK | And the definitions of each

📘 Overview 🧮 Simulator 🧮 Noise Sensitivity, Bandwidth, Complexity, etc. 🧮 MATLAB Codes 🧮 Some Questions and Answers 📚 Further Reading Modulation ASK, FSK & PSK Constellation MATLAB Simulink MATLAB Code Comparisons among ASK, PSK, and FSK    Comparisons among ASK, PSK, and FSK   Simulator for Calculating Bandwidth of ASK, FSK, and PSK The baud rate represents the number of symbols transmitted per second. Both baud rate and bit rate are same for binary ASK, FSK, and PSK. Select Modulation Type: ASK FSK PSK Baud Rate or Bit Rate (bps): Frequency Deviation (Hz) for FSK: Calculate Bandwidth Comparison among ASK,  FSK, and PSK Performance Comparison: 1. Noise Sensitivity:    - ASK is the most sensitive to noise due to its r...

MATLAB code for BER vs SNR for M-QAM, M-PSK, QPSk, BPSK, ...

📘 Overview 🧮 Simulator for m-ary QAM and m-ary PSK 🧮 MATLAB Code for BPSK, M-ary PSK, and M-ary QAM Together 🧮 MATLAB Code for M-ary QAM 🧮 MATLAB Code for M-ary PSK 📚 Further Reading   MATLAB Script for  BER vs. SNR for M-QAM, M-PSK, QPSk, BPSK %Written by Salim Wireless %Visit www.salimwireless.com for study materials on wireless communication %or, if you want to learn how to code in MATLAB clc; clear; close all; % Parameters num_symbols = 1e5; % Number of symbols snr_db = -20:2:20; % Range of SNR values in dB % PSK and QAM orders to be tested psk_orders = [2, 4, 8, 16, 32]; qam_orders = [4, 16, 64, 256]; % Initialize BER arrays ber_psk_results = zeros(length(psk_orders), length(snr_db)); ber_qam_results = zeros(length(qam_orders), length(snr_db)); % BER calculation for each PSK order and SNR value for i = 1:length(psk_orders) psk_order = psk_orders(i); for j = 1:length(snr_db) % Generate random symbols ...

Channel Impulse Response (CIR)

Channel Impulse Response (CIR) 📘 Overview & Theory 📘 How does the channel impulse response affect the signal? 🧮 MATLAB Codes 📚 Further Reading Wireless Signal Processing CIR, Doppler Shift & Gaussian Random Variable  The Channel Impulse Response (CIR) is a concept primarily used in the field of telecommunications and signal processing. It provides information about how a communication channel responds to an impulse signal.   What is the Channel Impulse Response (CIR) ? It describes the behavior of a communication channel in response to an impulse signal. In signal processing,  an impulse signal has zero amplitude at all other times and amplitude  ∞ at time 0 for the signal. Using a Dirac Delta function, we can approximate this.  ...(i) δ( t) now has a very intriguing characteristic. The answer is 1 when the Fourier Transform of  δ( t) is calculated. As a result, all frequencies ar...

MATLAB Code for Pulse Amplitude Modulation (PAM) and Demodulation

📘 Overview & Theory 🧮 MATLAB Code 1 🧮 MATLAB Code 2 🧮 MATLAB Code for Pulse Amplitude Modulation and Demodulation of Digital data 🧮 Other Pulse Modulation Techniques (e.g., PWM, PPM, DM, and PCM) 📚 Further Reading   Pulse Amplitude Modulation (PAM) & Demodulation MATLAB Script clc; clear all; close all; fm= 10; % frequency of the message signal fc= 100; % frequency of the carrier signal fs=1000*fm; % (=100KHz) sampling frequency (where 1000 is the upsampling factor) t=0:1/fs:1; % sampling rate of (1/fs = 100 kHz) m=1*cos(2*pi*fm*t); % Message signal with period 2*pi*fm (sinusoidal wave signal) c=0.5*square(2*pi*fc*t)+0.5; % square wave with period 2*pi*fc s=m.*c; % modulated signal (multiplication of element by element) subplot(4,1,1); plot(t,m); title('Message signal'); xlabel ('Time'); ylabel('Amplitude'); subplot(4,1,2); plot(t,c); title('Carrier signal'); xlabel('Time'); ylabel('Amplitu...