数字信号的产生和基本运算
2019-07-13 19:07发布
生成海报
常用数字信号序列的产生
单位冲激序列δ(n)
function [ x,n ] = impseq( n0,n1,n2 )
if ((n0n2) || (n1>n2))
error('Arguments must satisfy n1 <= n0 <= n2')
end
n = [n1:n2];
x = [(n-n0) == 0];
>> n=[-10:10];
>> y=impseq(0,-10,10);
>> stem(n,y)
单位阶跃序列2u(n−5)
function [ x,n ] = stepseq( n0,n1,n2 )
if ((non2) || (n1>n2))
error('Arguments must satisfy n1 <= n0 <= n2')
end
n = [n1:n2];
x = [(n-n0) >= 0];
>>n=[-10:10];
>>y=2*stepseq(5,-10,10);
>>stem(n,y)
矩形序列 R5(n)
>> n=[-10:10];
>> y=stepseq(0,-10,10)-stepseq(5,-10,10);
>> stem(n,y)
y(n)=2sin(0.3πn)+0.5cos2(0.6πn)
>> n=[-10:10];
>> y=2*sin(0.3*pi*n)+0.5*(cos(0.6*pi*n)).^2;
>> stem(n,y)
数字信号的基本运算
>> R=audiorecorder(44100,16,1);
>> recordblocking(R,45);
>> play(R);
>> x = getaudiodata(R);
>> audiowrite('myNews.wav',x,44100);
>> [y,Fs]=audioread('bgm.mp3');
>> y1=y(1:1984500,1);
>> z=0.7*x+0.3*y1;
>> audiowrite('MySpeech.wav',z,44100);
>> t=[1:1984500];
>> figure
>> plot(t,x,t,y1,t,z);
>> title('z(n)=0.3*x(n)+0.7*y(n)');
>> subplot(3,1,1),plot(x),title('MyNews');
>> subplot(3,1,2),plot(y1),title('bgm');
>> subplot(3,1,3),plot(z),title('MySpeech');
注:蓝 {MOD}为
x(n),绿 {MOD}为
y(n),红 {MOD}为
z(n)
注
数字信号处理
Matlab实验一
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮