matlab写 phase modulation (x_PM), and (2) frequency modulation (x_FM) (m(t) = 0 for t < 0).
时间: 2024-06-01 08:12:32 浏览: 77
Phase Modulation:
Assuming the message signal is given by m(t), the carrier signal by c(t) and the modulation index by k, the phase modulated signal x_PM can be written as:
x_PM = Acos(ω_c t + k m(t))
where A is the amplitude of the carrier signal and ω_c is the angular frequency of the carrier signal.
In MATLAB, we can write the code for phase modulation as follows:
% Defining the message signal
fm = 100; % message signal frequency
Tm = 1/fm; % message signal period
t = 0:Tm/1000:10*Tm; % time vector
m = sin(2*pi*fm*t).*(t>=0); % message signal (m(t) = 0 for t < 0)
% Defining the carrier signal
fc = 1000; % carrier signal frequency
Tc = 1/fc; % carrier signal period
c = cos(2*pi*fc*t); % carrier signal
% Defining the modulation index
k = 1;
% Phase modulation
x_PM = cos(2*pi*fc*t + k*m);
% Plotting the signals
subplot(3,1,1);
plot(t,m);
title('Message Signal');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(3,1,2);
plot(t,c);
title('Carrier Signal');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(3,1,3);
plot(t,x_PM);
title('Phase Modulated Signal');
xlabel('Time (s)');
ylabel('Amplitude');
Frequency Modulation:
Assuming the message signal is given by m(t), the carrier signal by c(t), the modulation index by β and the frequency deviation by Δf, the frequency modulated signal x_FM can be written as:
x_FM = Acos(2πfct + 2πβ∫m(τ)dτ)
where A is the amplitude of the carrier signal and fc is the frequency of the carrier signal.
In MATLAB, we can write the code for frequency modulation as follows:
% Defining the message signal
fm = 100; % message signal frequency
Tm = 1/fm; % message signal period
t = 0:Tm/1000:10*Tm; % time vector
m = sin(2*pi*fm*t).*(t>=0); % message signal (m(t) = 0 for t < 0)
% Defining the carrier signal
fc = 1000; % carrier signal frequency
Tc = 1/fc; % carrier signal period
c = cos(2*pi*fc*t); % carrier signal
% Defining the modulation index and frequency deviation
beta = 10;
Delta_f = beta*fm;
% Frequency modulation
x_FM = cos(2*pi*fc*t + 2*pi*beta*cumsum(m));
% Plotting the signals
subplot(3,1,1);
plot(t,m);
title('Message Signal');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(3,1,2);
plot(t,c);
title('Carrier Signal');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(3,1,3);
plot(t,x_FM);
title('Frequency Modulated Signal');
xlabel('Time (s)');
ylabel('Amplitude');
阅读全文
相关推荐


















