gusucode.com > matlab通信工程仿真源码(张德丰等编著)程序书籍 > matlab_code/matlab通信工程仿真源码(张德丰等编著)/第5章/li5_4.m

    dt=1e-5;
T=3*1e-3;
t=0:dt:T;
input=2*cos(2*pi*1000*t);
ca=5*cos(2*pi*1e4*t);
output=(2+0.5*input).*ca;
%作图:观察输入信号,载波,以及调制输出
subplot(311);
plot(t,input);
xlabel('时间/s'); ylabel('被调信号');
subplot(312);
plot(t,ca);
xlabel('时间/s'); ylabel('载波');
subplot(313);
plot(t,output);
xlabel('时间/s'); ylabel('调幅输出');

clear;
dt=1e-5;
T=3*1e-3;
t=0:dt:T;
for i=1:length(t)
    input(i)=2*cos(2*pi*1000*t(i));
    ca(i)=5*cos(2*pi*1e4*t(i));
    output(i)=(2+0.5*input(i)).*ca(i);
end
%作图:观察输入信号,载波,以及调制输出
subplot(311);
plot(t,input);
xlabel('时间/s'); ylabel('被调信号');
subplot(312);
plot(t,ca);
xlabel('时间/s'); ylabel('载波');
subplot(313);
plot(t,output);
xlabel('时间/s'); ylabel('调幅输出');