信号实验第一次作业Word文件下载.docx
《信号实验第一次作业Word文件下载.docx》由会员分享,可在线阅读,更多相关《信号实验第一次作业Word文件下载.docx(12页珍藏版)》请在冰点文库上搜索。
K=500;
k=0:
1:
K;
W=k*Wmax/K;
Xa=xa*exp(-j*t'
*W)*Dt;
Xa=real(Xa);
W=[-fliplr(W),W(2:
501)];
Xa=[fliplr(Xa),Xa(2:
subplot(2,2,1);
plot(t*1000,xa);
xlabel('
time(millisecond)'
);
ylabel('
xa(t)'
title('
anologsignal'
subplot(2,2,2);
plot(W/(2*pi*1000),Xa*1000);
frequency(kHZ)'
xa(jw)'
FT'
Ts=0.001;
n=-25:
25;
x=exp(-1000*abs(n*Ts));
w=pi*k/K;
X=x*exp(-j*n'
*w);
X=real(X);
w=[-fliplr(w),w(2:
K+1)];
X=[fliplr(X),X(2:
subplot(2,2,3);
stem(n*Ts*1000,x);
gtext('
Ts=0.2ms'
x1(n)'
discretesignal'
subplot(2,2,4);
plot(w/pi,X);
frequency(radian)'
x1(jw)'
DTFT'
[x1,n1]=impseq(-2,-5,5)
[x2,n2]=impseq(4,-5,5)
x=2*x1-x2
subplot(1,1,1);
stem(n1,x);
n'
x(n)'
axis([-6,6,-5,5]);
grid
n=-0:
50;
x=cos(0.04*pi*n)
subplot(2,1,1);
stem(n,x);
ylabel('
axis([0,50,-2,2]);
y=cos(0.04*pi*n)+0.2*randn(size(n))
subplot(2,1,2);
stem(n,y);
y(n)'
[u1,n]=stepsep(0,-20,20);
[u2,n]=stepsep(10,-20,20);
h=((0.9).^(n)).*u1
x=u1-u2;
[y,ny]=conv_m(x,n,h,n)
stem(ny,y);
axis([-1,32,-1,9]);
w=-2*pi:
2*pi/100:
2*pi;
x1=cos(x);
x2=[1-23];
y=conv(x1,x2);
h1=freqz(x1,1,w);
h2=freqz(x2,1,w);
hp=h1.*h2;
h3=freqz(y,1,w);
plot(w/pi,abs(hp));
grid;
plot(w/pi,abs(h3));
plot(w/pi,angle(hp));
plot(w/pi,angle(h3));
w=-pi:
2*pi/255:
pi;
wo=0.4*pi;
num1=[456789];
L=length(num1);
h1=freqz(num1,1,w);
n=0:
L-1;
num2=exp(wo*i*n).*num1;
h2=freqz(num2,1,w);
plot(w/pi,abs(h1));
plot(w/pi,abs(h2));
plot(w/pi,angle(h1));
plot(w/pi,angle(h2));
[x,fs]=wavread('
F:
\o1.wav'
Fs=150000;
yt0=fft(x);
subplot(2,2,1)
plot(x);
原语音信号波形'
yt01=abs(yt0);
subplot(2,2,2)
plot(yt01);
原语音信号的频谱'
x1=0:
length(x)-1;
x2=0:
2:
y1=interp1(x1,x,x2)
plot(x1,x,x2,y1);
恢复后语音信号的波形'
yt1=fft(y1);
yt1_=abs(y1);
plot(yt1_);
恢复后语音信号的频谱'
sound(y1)
helpspline
SPLINECubicsplinedatainterpolation.
PP=SPLINE(X,Y)providesthepiecewisepolynomialformofthe
cubicsplineinterpolanttothedatavaluesYatthedatasitesX,
forusewiththeevaluatorPPVALandthesplineutilityUNMKPP.
Xmustbeavector.
IfYisavector,thenY(j)istakenasthevaluetobematchedatX(j),
henceYmustbeofthesamelengthasX--seebelowforanexception
tothis.
IfYisamatrixorNDarray,thenY(:
...,:
j)istakenasthevalueto
bematchedatX(j),hencethelastdimensionofYmustequallength(X)--
seebelowforanexceptiontothis.
YY=SPLINE(X,Y,XX)isthesameasYY=PPVAL(SPLINE(X,Y),XX),thus
providing,inYY,thevaluesoftheinterpolantatXX.Forinformation
regardingthesizeofYYseePPVAL.
Ordinarily,thenot-a-knotendconditionsareused.However,ifYcontains
twomorevaluesthanXhasentries,thenthefirstandlastvalueinYare
usedastheendslopesforthecubicspline.IfYisavector,this
means:
f(X)=Y(2:
end-1),Df(min(X))=Y
(1),Df(max(X))=Y(end).
IfYisamatrixorN-DarraywithSIZE(Y,N)equaltoLENGTH(X)+2,then
f(X(j))matchesthevalueY(:
j+1)forj=1:
LENGTH(X),then
Df(min(X))matchesY(:
:
...:
1)andDf(max(X))matchesY(:
end).
Example:
Thisgeneratesasine-likesplinecurveandsamplesitoverafinermesh:
x=0:
10;
y=sin(x);
xx=0:
.25:
yy=spline(x,y,xx);
plot(x,y,'
o'
xx,yy)
Thisillustratestheuseofclampedorcompletesplineinterpolationwhere
endslopesareprescribed.Inthisexample,zeroslopesattheendsofan
interpolanttothevaluesofacertaindistributionareenforced:
x=-4:
4;
y=[0.151.122.362.361.46.49.060];
cs=spline(x,[0y0]);
xx=linspace(-4,4,101);
xx,ppval(cs,xx),'
-'
Classsupportforinputsx,y,xx:
float:
double,single
Seealsointerp1,ppval,unmkpp,mkpp,splines(TheSplineToolbox).