0% found this document useful (0 votes)
8 views2 pages

FM Signal Analysis and Visualization

The document is a MATLAB script that generates and analyzes message and carrier signals in both time and frequency domains. It visualizes the message and carrier signals, as well as frequency-modulated (FM) waveforms for different modulation indices. The script includes plots for the time and frequency domains of the signals, demonstrating the effects of varying modulation indices on FM waveforms.

Uploaded by

arvind572mm
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

FM Signal Analysis and Visualization

The document is a MATLAB script that generates and analyzes message and carrier signals in both time and frequency domains. It visualizes the message and carrier signals, as well as frequency-modulated (FM) waveforms for different modulation indices. The script includes plots for the time and frequency domains of the signals, demonstrating the effects of varying modulation indices on FM waveforms.

Uploaded by

arvind572mm
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

clc; clear; close all;

% Parameters
Fs = 5000; % Sampling frequency
T = 0:1/Fs:2-1/Fs; % Time vector (2 seconds)
L = length(T); % Length of signal

Am = 2; % Message amplitude
Fm = 10; % Message frequency
Ac = 5; % Carrier amplitude
Fc = 100; % Carrier frequency
M_index = [1, 5, 10]; % Modulation indices

% Message and Carrier Signals


Mt = Am * cos(2*pi*Fm*T);
Ct = Ac * cos(2*pi*Fc*T);

% Frequency axis
F_axis = (0:L-1)*(Fs/L);

% ---------- Figure 1: Message and Carrier Analysis ----------


figure('Name','Message and Carrier Analysis');

% Message signal (time domain)


subplot(2,2,1);
plot(T, Mt, 'b');
title('Message Signal (Time Domain)');
xlabel('Time (s)'); ylabel('Amplitude');
grid on; xlim([0 0.3]);

% Message signal (frequency domain)


subplot(2,2,2);
M_f = 2*abs(fft(Mt)/L);
stem(F_axis, M_f, 'filled');
title('Message Signal (Frequency Domain)');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
xlim([0 50]); grid on;

% Carrier signal (time domain)


subplot(2,2,3);
plot(T, Ct, 'r');
title('Carrier Signal (Time Domain)');
xlabel('Time (s)'); ylabel('Amplitude');
grid on; xlim([0 0.1]);

% Carrier signal (frequency domain)


subplot(2,2,4);
C_f = 2*abs(fft(Ct)/L);
stem(F_axis, C_f, 'filled');
title('Carrier Signal (Frequency Domain)');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
xlim([0 Fc+50]); grid on;

% ---------- Figure 2: FM Waveforms for Different Modulation Indices ----------


figure('Name','FM Waves with Different Modulation Indices');

for k = 1:length(M_index)
m = M_index(k); % Current modulation index

% FM Signal
Fm_wave = Ac * cos(2*pi*Fc*T + m*sin(2*pi*Fm*T));

% Time domain plot


subplot(3,2,2*k-1);
plot(T, Fm_wave, 'b');
title(['FM Wave (Time Domain) with m = ' num2str(m)]);
xlabel('Time (s)'); ylabel('Amplitude');
xlim([0 0.1]); grid on;

% Frequency domain plot


Y = fftshift(fft(Fm_wave))/L;
F_axis_shifted = (-L/2:L/2-1)*(Fs/L);
subplot(3,2,2*k);
stem(F_axis_shifted, 2*abs(Y), 'filled');
title(['FM Spectrum with m = ' num2str(m)]);
xlabel('Frequency (Hz)');
ylabel('Magnitude');
xlim([Fc-80 Fc+80]); grid on;
end

You might also like