baseband3.m

来自「基于MATLAB的基带仿真源码」· M 代码 · 共 40 行

M
40
字号
% 注意:运行此程序时要先在MATLAB主窗口中输入tutmodce;[t,x,yout] = euler('tutmodce',1);
%不然程序会提示缺乏定义的变量
% Sampling frequency
fs = 100;
% Lowpass filter
[num,den] = butter(2,100/2/pi/fs);
% DSB-SC AM simulation results - top left plot.
y = amodce(yout(:,1), 1/fs, 'amdsb-sc');
x = ademodce(y, 1/ts, 'amdsb-sc/costas', num, den);
figure(1)
plot(t, yout(:,1), t, x, 'y--', t, yout(:, 2), 'y--')
% DSB-TC AM simulation results - top right plot.
y = amodce(yout(:,1), 1/fs, 'amdsb-tc', 1);
x = ademodce(y, 1/ts, 'amdsb-tc/costas', 1, num, den);
figure(2)
plot(t, yout(:,1), t, x, 'y--', t, yout(:, 3), 'y--')
% FM simulation results - middle left plot.
y = amodce(yout(:,1), 1/fs, 'fm');
x = ademodce(y, 1/ts, 'fm', num, den);
figure(3)
plot(t, yout(:,1), t, x, 'y--', t, yout(:, 4), 'y--')
% PM simulation results - middle right plot.
y = amodce(yout(:,1), 1/fs, 'pm');
x = ademodce(y, 1/ts, 'pm', num, den);
figure(4)
plot(t, yout(:,1), t, x, 'y--', t, yout(:, 5), 'y--')
% SSB AM simulation results - bottom left plot.
[num_h, den_h] = hilbiir(fs, 10*fs, 10);
y = amodce(yout(:,1), 1/ts, 'amssb/time', num_h, den_h);
x = ademodce(y, 1/fs, 'amssb', num, den);
figure(5)
plot(t, yout(:,1), t, x, 'y--', t, yout(:, 6), 'y--')
% QAM simulation results - bottom right plot.
% There are two input signals for the QAM modulation, the in-
% phase component and the quadrature component. The plot compares
% both components.
y = amodce([yout(:,1), yout(:,9)], 1/ts, 'qam');
x = ademodce(y, 1/ts, 'qam', num, den);
figure(6)
plot(t, yout(:,1), t, x, 'y--', t, yout(:, 4), 'y--')

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?