clc; clear; close all;
% 1. Time and Sampling Setup
fs = 20000; % Sampling frequency (20 kHz)
t = 0 : 1/fs : 0.05; % Time duration (0.05 s)
% 2. Signal & Deviation Parameters
Am = 2; % Message amplitude (V)
Ac = 5; % Carrier amplitude (V)
fm = 50; % Message frequency (50 Hz)
fc = 600; % Carrier frequency (600 Hz)
kf = 150; % Frequency sensitivity (Hz/V)
delta_f = kf * Am; % Peak Frequency Deviation (300 Hz)
beta = delta_f / fm; % Modulation Index (beta = 6)
BW_carson = 2 * (delta_f + fm); % Carson's Rule Bandwidth (700 Hz)
fprintf('Delta f = %.2f Hz | Beta = %.2f | Carson BW = %.2f Hz\n', delta_f, beta, BW_carson);
% 3. Generate Signals
m_t = Am * cos(2 * pi * fm * t);
c_t = Ac * cos(2 * pi * fc * t);
s_fm = Ac * cos(2 * pi * fc * t + beta * sin(2 * pi * fm * t));
% 4. Plotting
figure('Name', '2. Frequency Modulation (FM)');
subplot(3, 1, 1); plot(t, m_t, 'b', 'LineWidth', 1.5);
title(['Message Signal m(t) (f_m = ', num2str(fm), ' Hz)']); ylabel('Amplitude (V)'); grid on;
subplot(3, 1, 2); plot(t, c_t, 'k', 'LineWidth', 1);
title(['Carrier Signal c(t) (f_c = ', num2str(fc), ' Hz)']); ylabel('Amplitude (V)'); grid on;
subplot(3, 1, 3); plot(t, s_fm, 'g', 'LineWidth', 1.2);
title(['FM Signal (\beta = ', num2str(beta), ', BW = ', num2str(BW_carson), ' Hz)']);
xlabel('Time (s)'); ylabel('Amplitude (V)'); grid on;
To embed this project on your website, copy the following code and paste it into your website's HTML: