Q1.28 编写一个MATLAB程序,以产生并显示五个长度为31的随机信号。
{X[n]}={A错误!未找到引用源。}
其中振幅A和相位Φ是统计独立的随机变量,振幅在区间0错误!未找到引用源。相位区间在0错误!未找到引用源。内均匀分布。 答:程序:clear,clc
n=0:31; B=0; A=0; f=100
A=4.*rand(1,length(n));
B=2.*pi*rand(1,length(n)); x=A.*cos(2*pi*f.*n+B); subplot(5,1,1) plot(n,x)
axis([0 31 -4 4]); grid;
title('随机正弦信号一');xlabel('n');ylabel('幅值A');
A=4.*rand(1,length(n));
B=2.*pi*rand(1,length(n)); x=A.*cos(2*pi*f.*n+B); subplot(5,1,2) plot(n,x)
axis([0 31 -4 4]); grid;
title('随机正弦信号二');xlabel('n');ylabel('幅值A');
A=4.*rand(1,length(n));
B=2.*pi*rand(1,length(n)); x=A.*cos(2*pi*f.*n+B); subplot(5,1,3) plot(n,x)
axis([0 31 -4 4]); grid;
title('随机正弦信号三');xlabel('n');ylabel('幅值A');
A=4.*rand(1,length(n));
B=2.*pi*rand(1,length(n)); x=A.*cos(2*pi*f.*n+B); subplot(5,1,4) plot(n,x)

