Frequency modulation without fmmode?
1 view (last 30 days)
Show older comments

I was able to solve it manually but I couldn't do it in python. I found Phi(t)= 200* PI* Triangle(t-2/2), Y(f)= sinc^2 but I couldn't define them manually in python, can you help me?
Answers (1)
Hassaan
on 12 Jan 2024
Edited: Hassaan
on 12 Jan 2024
@cagri esen Assumming MATLAB environment.
% Parameters
k_f = 50; % Frequency sensitivity
f_c = 500; % Carrier frequency in Hz
t = linspace(-1, 1, 1000); % Time vector
% Message signal m(t)
m_t = tripuls(t-1/2, 2); % Triangular pulse
% Phase signal phi(t)
phi_t = 2 * k_f * cumtrapz(t, m_t); % Integral of m(t) with k_f
% FM signal y(t)
y_t = 5 * cos(2 * pi * f_c * t + phi_t);
% Plot the message signal m(t)
figure;
plot(t, m_t);
title('Message Signal m(t)');
xlabel('Time [s]');
ylabel('Amplitude');
% Magnitude spectrum of the message signal
M_f = abs(fft(m_t));
frequencies = linspace(-500, 500, length(M_f)); % Frequency vector for plotting
figure;
plot(frequencies, fftshift(M_f));
title('Magnitude Spectrum of m(t)');
xlabel('Frequency [Hz]');
ylabel('Magnitude');
% Plot the phase signal phi(t)
figure;
plot(t, phi_t);
title('Phase Signal \phi(t)');
xlabel('Time [s]');
ylabel('Phase');
% Magnitude spectrum of the phase signal
P_f = abs(fft(phi_t));
figure;
plot(frequencies, fftshift(P_f));
title('Magnitude Spectrum of \phi(t)');
xlabel('Frequency [Hz]');
ylabel('Magnitude');
% Plot the FM signal y(t)
figure;
plot(t, y_t);
title('FM Signal y(t)');
xlabel('Time [s]');
ylabel('Amplitude');
% Magnitude spectrum of the FM signal
Y_f = abs(fft(y_t));
figure;
plot(frequencies, fftshift(Y_f));
title('Magnitude Spectrum of y(t)');
xlabel('Frequency [Hz]');
ylabel('Magnitude');
% Demodulation (simplified representation)
% Differentiation
diff_phi_t = [diff(phi_t) 0]; % Differentiate phi(t)
% Diode (rectification)
rectified_phi_t = abs(diff_phi_t); % Model diode as absolute value
% Low-pass filter
LPF_phi_t = lowpass(rectified_phi_t, 1, 1/(t(2)-t(1))); % Using built-in lowpass
% DC blocking (high-pass filter)
HPF_phi_t = highpass(LPF_phi_t, 0.1, 1/(t(2)-t(1))); % Using built-in highpass
% Plot the demodulated signal
figure;
plot(t, HPF_phi_t);
title('Demodulated Signal');
xlabel('Time [s]');
ylabel('Amplitude');
- Defines the message signal as a triangular pulse.
- Computes the phase signal by integrating the message signal, scaled by kf.
- Generates the FM signal by modulating the cosine wave with the phase signal.
- Plots the message signal and its magnitude spectrum.
- Plots the phase signal and its magnitude spectrum.
- Plots the FM signal and its magnitude spectrum.
- Performs a simplified demodulation of the FM signal, including differentiation, rectification (diode), low-pass filtering, and DC blocking (high-pass filtering).
- Plots the demodulated signal.
----------------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
Feel free to contact me.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





