0% found this document useful (0 votes)
33 views

Spectrogram

This document defines parameters for generating and analyzing a multi-frequency shift keying (MFSK) signal. It defines a sampling frequency, time duration, and frequency bands. It generates an MFSK signal by shifting between the frequency bands over time. It simulates signal transmission by adding delay and attenuation to the signal. Finally, it creates spectrograms of the transmitted and received signals to visualize the frequency shifts over time.

Uploaded by

tayybahaseeb18
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Spectrogram

This document defines parameters for generating and analyzing a multi-frequency shift keying (MFSK) signal. It defines a sampling frequency, time duration, and frequency bands. It generates an MFSK signal by shifting between the frequency bands over time. It simulates signal transmission by adding delay and attenuation to the signal. Finally, it creates spectrograms of the transmitted and received signals to visualize the frequency shifts over time.

Uploaded by

tayybahaseeb18
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

% Constants

fs = 10e6; % Sampling frequency (10 MHz)


T = 50e-6; % Time duration of the signal (50 microseconds)
t = 0:1/fs:T; % Time vector

% Parameters for MFSK waveform - Distinct frequency bands


frequencies = [500e3, 1e6, 1.5e6, 2.5e6, 3.5e6]; % Frequencies for distinct
bands
num_bands = length(frequencies); % Number of frequency bands

% Generate MFSK signal at the transmitter using distinct frequency bands


mfsk_tx_signal = zeros(1, length(t));
band_duration = T / num_bands; % Duration of each frequency band

for i = 1:num_bands
band_time = t((i - 1) * length(t) / num_bands + 1 : i * length(t) /
num_bands);
tone = sin(2 * pi * frequencies(i) * band_time);
mfsk_tx_signal((i - 1) * length(t) / num_bands + 1 : i * length(t) /
num_bands) = tone;
end

delay = 10;
attenuation = 0.5;
mfsk_rx_signal = [zeros(1, delay), mfsk_tx_signal(1:end - delay)] *
attenuation;

% Spectrogram parameters
window = kaiser(128, 4); % Window size
noverlap = 100; % Overlap
nfft = 256; % FFT size

% Create and plot the spectrogram for transmitter signal


figure;
subplot(2, 1, 1);
spectrogram(mfsk_tx_signal, window, noverlap, nfft, fs, 'yaxis', 'reassigned',
'MinThreshold', -60);
title('Transmitted MFSK Signal Spectrogram');
xlabel('Time (s)');
ylabel('Frequency (Hz)');
colormap('jet');

% Create and plot the spectrogram for receiver signal


subplot(2, 1, 2);
spectrogram(mfsk_rx_signal, window, noverlap, nfft, fs, 'yaxis', 'reassigned',
'MinThreshold', -60);
title('Received MFSK Signal Spectrogram');
xlabel('Time (s)');
ylabel('Frequency (Hz)');
colormap('jet');

You might also like