📄 exa011003_randn.m
字号:
%-----------------------------------------------------------------
% exa011003_randn, for example 1.10.3
% to test randn.m and to generate the white noise signal u(n)
% with Gaussian distribution and power p
% 产生高斯分布的白噪信号,使功率为p,并观察数据分布的直方图
%-----------------------------------------------------------------
clear;
p=0.1;
N=500000;
u=randn(1,N);
a=sqrt(p)
u=u*a;
power_u=var(u)
subplot(211)
plot(u(1:200));grid on;
ylabel('u(n)');
xlabel('n')
subplot(212)
hist(u,50);grid on;
ylabel('histogram of u(n)');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -