1、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(anolog signalsubplot(2,2,2);plot(W/(2*pi*1000),Xa*1000);frequency(kHZ)xa(jw)FTTs=0.001;n=-25:25;x=exp(-1000*abs(n*Ts);w=pi*k/K;
2、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.2msx1(n)discrete signalsubplot(2,2,4);plot(w/pi,X);frequency(radian)x1(jw)DTFTx1,n1=impseq(-2,-5,5)x2,n2=impseq(4,-5,5)x=2*x1-x2subplot(1,1,1);stem(n1,x);nx(n)axis(-6,6,-5,5);gridn=-0:50;x=cos
3、(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).*u1x=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 -2 3;y=conv(x1,x2);h1
4、=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=4 5 6 7 8 9;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,ab
5、s(h2); plot(w/pi,angle(h1); plot(w/pi,angle(h2);x,fs=wavread(F:o1.wavFs=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)help spli
6、ne SPLINE Cubic spline data interpolation. PP = SPLINE(X,Y) provides the piecewise polynomial form of the cubic spline interpolant to the data values Y at the data sites X, for use with the evaluator PPVAL and the spline utility UNMKPP. X must be a vector. If Y is a vector, then Y(j) is taken as the
7、 value to be matched at X(j), hence Y must be of the same length as X - see below for an exception to this. If Y is a matrix or ND array, then Y(:,.,:,j) is taken as the value to be matched at X(j), hence the last dimension of Y must equal length(X) - see below for an exception to this. YY = SPLINE(
8、X,Y,XX) is the same as YY = PPVAL(SPLINE(X,Y),XX), thus providing, in YY, the values of the interpolant at XX. For information regarding the size of YY see PPVAL. Ordinarily, the not-a-knot end conditions are used. However, if Y contains two more values than X has entries, then the first and last va
9、lue in Y are used as the endslopes for the cubic spline. If Y is a vector, this means: f(X) = Y(2:end-1), Df(min(X)=Y(1), Df(max(X)=Y(end). If Y is a matrix or N-D array with SIZE(Y,N) equal to LENGTH(X)+2, then f(X(j) matches the value Y(:,j+1) for j=1:LENGTH(X), then Df(min(X) matches Y(:,:,.:,1)
10、and Df(max(X) matches Y(:,end). Example: This generates a sine-like spline curve and samples it over a finer mesh: x = 0:10; y = sin(x); xx = 0:.25: yy = spline(x,y,xx); plot(x,y,o,xx,yy) This illustrates the use of clamped or complete spline interpolation where end slopes are prescribed. In this ex
11、ample, zero slopes at the ends of an interpolant to the values of a certain distribution are enforced: x = -4:4; y = 0 .15 1.12 2.36 2.36 1.46 .49 .06 0; cs = spline(x,0 y 0); xx = linspace(-4,4,101);,xx,ppval(cs,xx),- Class support for inputs x, y, xx: float: double, single See also interp1, ppval, unmkpp, mkpp, splines (The Spline Toolbox).
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2