'MATLAB FM Modulation with symbolic integration

I am trying to FM modulate a signal but the frequency of the modulated wave remains constant. We are not allowed to use fmmod or cumsum functions, only int() or quad() functions are allowed.

% Generation of FM
clc
clearvars

sampling_freq = 1000; % fs = 1Khz
time = 0:(1/sampling_freq):0.1;

syms t
message = 0.2*cos(2*pi*10*t); % m(t) = Am*sin(2*pi*fm*t)
carrier = 1*sin(2*pi*200*t); % c(t) = Ac*sin(2*pi*fc*t)
modulator_sensitivity = 50; % Modulator sensitivity

integrated(t) = int(message, t);

modulated = 1*cos(2*pi*200*t + 2*pi*modulator_sensitivity*integrated)

beta = (modulator_sensitivity * 0.2) / 10; % beta = (kf*Am)/fm

fplot(modulated, [time(1) time(end)])
title("Message and Modulated Signal")

hold on

fplot(message, [time(1) time(end)])

Plotted message and modulated waves



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source