数字信号实验1.docx
《数字信号实验1.docx》由会员分享,可在线阅读,更多相关《数字信号实验1.docx(13页珍藏版)》请在冰豆网上搜索。
数字信号实验1
2.
Docconv
Description
Letm=length(u)andn=length(v).Thenwisthevectoroflengthm+n-1whosekthelementis
Thesumisoverallthevaluesofjwhichleadtolegalsubscriptsforu(j)andv(k+1-j),specificallyj=max(1,k+1-n):
min(k,m).Whenm=n,thisgives
w
(1)=u
(1)*v
(1)
w
(2)=u
(1)*v
(2)+u
(2)*v
(1)
w(3)=u
(1)*v(3)+u
(2)*v
(2)+u(3)*v
(1)
...
w(n)=u
(1)*v(n)+u
(2)*v(n-1)+...+u(n)*v
(1)
...
w(2*n-1)=u(n)*v(n)
翻译:
让m=长度(u)和n=(v)。
那么w是向量的长度m+n-1k元素是
结束所有的值求和j导致法律下标u(j)和v(k+1-j),特别是j=max(k+其它):
min(k、m)。
当m=n,这给了
w
(1)=u
(1)*
(1)
w
(2)=u
(1)*
(2)+u
(2)*
(1)
w(3)=u
(1)*(3)+u
(2)*
(2)+u(3)*
(1)
…
w(n)=u
(1)*v(n)+u
(2)*(n-1)+…+u(n)*
(1)
…
w(2*n-1)=uv(n)*(n)
docnum2str
Thenum2strfunctionconvertsnumberstotheirstringrepresentations.Thisfunctionisusefulforlabelingandtitlingplotswithnumericvalues.
str=num2str(A)convertsarrayAintoastringrepresentationstr.Convertedfloating-pointvalueshaveamaximumoffourdigitsofprecision,andanexponentifrequired.Forintegervalues,num2strreturnstheexactstringrepresentationofthevalue.
str=num2str(A,precision)convertsthearrayAintoastringrepresentationstrwiththemaximumnumberofdigitsspecifiedbyprecision.
str=num2str(A,format)convertsarrayAusingthesuppliedformat,asdescribedonthefprintffunctionreferencepage.Bydefault,num2strdisplaysfloatingpointvaluesusingthe'%11.4g'format(foursignificantdigitsinexponentialorfixed-pointnotation,whicheverisshorter).
翻译:
num2str函数将数字转换为字符串表示。
这个函数是用于标签和标题的情节与数值。
str=num2str(A)将一个数组转换成一个字符串str。
转换精度浮点值有最大的四个数字,和一个指数如果需要。
为整数值,num2str返回的字符串表示的值。
str=num2str(精度)的数组转换成字符串表示str由精密数字指定的最大数量。
str=num2str(格式)转换数组使用提供的格式,如流函数参考网页上的描述。
默认情况下,num2str显示浮点值使用“%11.4g”格式(四个有效数字在指数或定点表示法,哪个更短)。
Docfilter
Thefilterfunctionfiltersadatasequenceusingadigitalfilterwhichworksforbothrealandcomplexinputs.ThefilterisadirectformIItransposedimplementationofthestandarddifferenceequation(see"Algorithm").
y=filter(b,a,X)filtersthedatainvectorXwiththefilterdescribedbynumeratorcoefficientvectorbanddenominatorcoefficientvectora.Ifa
(1)isnotequalto1,filternormalizesthefiltercoefficientsbya
(1).Ifa
(1)equals0,filterreturnsanerror.
IfXisamatrix,filteroperatesonthecolumnsofX.IfXisamultidimensionalarray,filteroperatesonthefirstnonsingletondimension.
[y,zf]=filter(b,a,X)returnsthefinalconditions,zf,ofthefilterdelays.IfXisaroworcolumnvector,outputzfisacolumnvectorofmax(length(a),length(b))-1.IfXisamatrix,zfisanarrayofsuchvectors,oneforeachcolumnofX,andsimilarlyformultidimensionalarrays.
[y,zf]=filter(b,a,X,zi)acceptsinitialconditions,zi,andreturnsthefinalconditions,zf,ofthefilterdelays.Inputziisavectoroflengthmax(length(a),length(b))-1,oranarraywiththeleadingdimensionofsizemax(length(a),length(b))-1andwithremainingdimensionsmatchingthoseofX.
y=filter(b,a,X,zi,dim)and[...]=filter(b,a,X,[],dim)operateacrossthedimensiondim.
翻译:
过滤函数过滤数据序列使用数字滤波器工作实际和复杂的输入。
过滤器是一种直接二转置实现标准的差分方程(见“算法”)。
y=过滤器(b,a,X)过滤器过滤的数据向量X描述分子系数向量b和分母系数向量a。
如果一个
(1)不等于1,滤波器可实现滤波器系数
(1)。
如果
(1)=0,过滤器返回一个错误。
如果X是一个矩阵,过滤操作的列X如果X是一个多维数组,过滤作用于第一nonsingleton维度。
[y,zf]=过滤器(b,a,X)返回最后一个条件,过滤器的zf延迟。
如果X是一个行或列向量,输出zf是一个列向量的最大长度(长度(a)、(b))1。
如果X是一个矩阵,zf这样的向量是一个数组,一个用于每一列(X)和类似的多维数组。
[y,zf]=过滤器(b,a,X,zi)接受初始条件,子,并返回最终的条件,过滤器的zf延迟。
输入子是一个向量的最大长度(长度(a)、(b))1,或数组大小的主要维度最大长度(长度(a)、(b))1和剩余的尺寸匹配的X。
y=过滤器(b,a,X,子,暗)和[…)=过滤器(b,a,X,[],昏暗的)跨维度的操作。
Docimpz
Thenextsectionsdescribecommonimpzoperationwithadaptive,discrete-time,andmultiratefilters.Formoreinputoptions,refertoimpzinSignalProcessingToolboxdocumentation.
翻译:
下一小节将描述常见impz操作与自适应离散,多重速率的过滤器。
更多的输入选项,请参阅impz信号处理工具箱中的文档。
3.docstem
Docconv
num2str(pi)is3.142.
num2str(eps)is2.22e-16.
num2str(randn(2,2),3)producesthefollowingstringmatrix:
num2str(randn(2,2),3)
ans=
0.538-2.26
1.830.862
num2strwithaformatof%10.5e\nreturnsamatrixofstringsinexponentialformat,having5decimalplaces,witheachelementseparatedbyanewlinecharacter:
x=rand(2,3)*9999;%Createa2-by-3matrix.
A=num2str(x,'%10.5e\n')%Converttostringarray.
A=
6.87255e+003
1.55597e+003
8.55890e+003
3.46077e+003
1.91097e+003
4.90201e+003
Docfilter
data=[1:
0.2:
4]';
windowSize=5;
filter(ones(1,windowSize)/windowSize,1,data)
ans=0.2000
0.4400
0.7200
1.0400
1.4000
1.6000
1.8000
2.0000
2.2000
2.4000
2.6000
2.8000
3.0000
3.2000
3.4000
3.6000
Q2.1
Q2.2
Q2.3
clf;
n=0:
100;
s1=cos(2*pi*0.5*n);
s2=cos(2*pi*0.7*n);
x=s1+s2;
M=2;
num=ones(1,M);
y=filter(num,1,x)/M;
subplot(2,2,1);
plot(n,s1);
axis([0,100,-2,2]);
xlabel('时间序号n');ylabel('振幅');
title('信号#1');
subplot(2,2,2);
plot(n,s2);
axis([0,100,-2,2]);
xlabel('时间序号n');ylabel('振幅');
title('信号#2');
subplot(2,2,3);
plot(n,x);
axis([0,100,-2,2]);
xlabel('时间序号n');ylabel('振幅');
title('输入信号');
subplot(2,2,4);
plot(n,y);
axis([0,100,-2,2]);
xlabel('时间序号n');ylabel('振幅');
title('输出信号');
axis;
Q2.4
Q2.5
Q2.6
Q2.7
Q2.12