[Matlab]在信号调幅过程中用方波进行调幅还是正弦波?为啥?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Matlab]在信号调幅过程中用方波进行调幅还是正弦波?为啥?相关的知识,希望对你有一定的参考价值。

参考技术A 你试试这个程序,看可行不?
%作者:浮云
%功能:信号调幅
%时间:2011-4-7
close
all
clear
all
clc
tic
ts=0.001;
%采样时间
T=10.00;
%所选信号时间长度
N=T/ts;
%信号采样点数
t=(0:N-1)*ts;
%时间轴
N个点
A=1;
%待调制信号振幅
B=1;
%载波信号振幅
fx=10;
%待调制信号频率
fc=100;
%载波信号频率
x=A*cos(2*pi*fx*t);
%待调制信号,频率为10Hz
y1=cos(2*pi*fc*t);
%正弦调制信号,频率为200Hz
y2=square(2*pi*100*t);
%方波调制信号,频率为200Hz
z1=(B+x).*y1;
%调制后的信号
z2=(B+x).*y2;
%调制后的信号
%平顶窗函数
for
i=1:N
w(i)=1-1.93*cos(2*pi*(i-1)/(N-1))+1.29*cos(4*pi*(i-1)/(N-1))-0.388*cos(6*pi*(i-1)/(N-1))+0.0322*cos(8*pi*(i-1)/(N-1));
end
X=x.*w;
%各信号加窗
Y1=y1.*w;
Y2=y2.*w;
Z1=z1.*w;
Z2=z2.*w;
Nf
=
2^nextpow2(N);%
求得最接近总采样点的2^N
f
=
linspace(0,1,Nf/2+1)/(2*ts);%频率轴(只画到Fs/2即可,由于x为实数,后面一半是对称的)
X
=
fft(X,Nf)/N;
%进行fft变换(除以总采样点数,是为了后面精确看出原始信号幅值)
Y1
=
fft(Y1,Nf)/N;
Y2
=
fft(Y2,Nf)/N;
Z1
=
fft(Z1,Nf)/N;
Z2
=
fft(Z2,Nf)/N;
tM=2/fx;
%限定显示范围,只显示两个周期
nM=tM/ts;
%画正弦波调制波形
figure
subplot(3,2,1)
plot(t(1:nM),x(1:nM));
xlim([0,tM]);
title('调制前信号');
xlabel('t/s');
ylabel('x');
hold
on
subplot(3,2,2)
plot(f,abs(X(1:Nf/2+1)));
title('原信号频谱');
xlabel('f/HZ');
ylabel('X');
hold
on
subplot(3,2,3)
plot(t(1:nM),y1(1:nM));
xlim([0,tM]);
title('调制信号');
xlabel('t/s');
ylabel('y1');
hold
on
subplot(3,2,4)
plot(f,abs(Y1(1:Nf/2+1)));
title('调制信号频谱');
xlabel('f/HZ');
ylabel('Y1');
hold
on
subplot(3,2,5)
plot(t(1:nM),z1(1:nM));
xlim([0,tM]);
title('调制后信号频谱');
xlabel('t/s');
ylabel('z1');
hold
on
subplot(3,2,6)
plot(f,abs(Z1(1:Nf/2+1)));
title('调制后信号');
xlabel('f/HZ');
ylabel('Z1');
hold
on
%画方波调制波形
figure
subplot(3,2,1)
plot(t(1:nM),x(1:nM));
xlim([0,tM]);
title('调制前信号');
xlabel('t/s');
ylabel('x');
hold
on
subplot(3,2,2)
plot(f,abs(X(1:Nf/2+1)));
title('原信号频谱');
xlabel('f/HZ');
ylabel('X');
hold
on
subplot(3,2,3)
plot(t(1:nM),y2(1:nM));
xlim([0,tM]);
title('调制信号');
xlabel('t/s');
ylabel('y2');
hold
on
subplot(3,2,4)
plot(f,abs(Y2(1:Nf/2+1)));
title('调制信号频谱');
xlabel('f/HZ');
ylabel('Y2');
hold
on
subplot(3,2,5)
plot(t(1:nM),z2(1:nM));
xlim([0,tM]);
title('调制后信号频谱');
xlabel('t/s');
ylabel('z1');
hold
on
subplot(3,2,6)
plot(f,abs(Z2(1:Nf/2+1)));
title('调制后信号');
xlabel('f/HZ');
ylabel('Z2');
hold
on
toc

以上是关于[Matlab]在信号调幅过程中用方波进行调幅还是正弦波?为啥?的主要内容,如果未能解决你的问题,请参考以下文章

信号处理标准调幅信号产生+解调matlab源码

模拟信号基于matlab抑制载波双边带调幅信号产生+解调含Matlab源码 985期

模拟信号基于matlab抑制载波双边带调幅信号产生+解调

如何用matlab 绘制出如图三角调幅信号的频谱图(转化为数字序列,用FFT求)

对AM信号FFT的matlab仿真

毕业设计/Matlab项目调幅AM/调频FM/DPSK/FSK的调制解调matlab界面