100 likes | 287 Vues
>> t=-4:0.01:4; xt=abs(t)<=1; >> w=-8*pi:0.01:8*pi; Xw=sinc(w/2/pi); >> subplot(1,2,1);plot(t,xt); title('x(t)');axis([-4,4,-0.2 1.2]) >> subplot(1,2,2);plot(w,Xw); title('X(Omega)');. >> t=-8*pi:0.01:8*pi; xt=sinc(t/2/pi); >> w=-4:0.01:4; Xw=2*pi*(abs(w)<=1);
E N D
>> t=-4:0.01:4; xt=abs(t)<=1; >> w=-8*pi:0.01:8*pi; Xw=sinc(w/2/pi); >> subplot(1,2,1);plot(t,xt); title('x(t)');axis([-4,4,-0.2 1.2]) >> subplot(1,2,2);plot(w,Xw); title('X(\Omega)');
>> t=-8*pi:0.01:8*pi; xt=sinc(t/2/pi); >> w=-4:0.01:4; Xw=2*pi*(abs(w)<=1); >> subplot(1,2,1);plot(t,xt); title('x(t)');axis([-8*pi,8*pi,-1 6.5]) >> subplot(1,2,2);plot(w,Xw); title('X(\Omega)');
>> w=-4*pi:0.001:4*pi; >> xw=exp(j*w)+2+3*exp(-j*w)+4*exp(-j*2*w)+5*exp(-j*3*w); >> subplot(2,1,1); plot(w/pi,abs(xw));title('|x(\omega)|') >> subplot(2,1,2); plot(w/pi,angle(xw));title('Phase of x(\omega)')
>> w=-4*pi:0.001:4*pi; >> xw=exp(j*w)./(exp(j*w)-0.5); >> subplot(2,1,1); plot(w/pi,abs(xw));title('|x(\omega)|') >> subplot(2,1,2); plot(w/pi,angle(xw));title('Phase of x(\omega)')
%script file to calculate DTFT of x(n)=(0.9exp(j*pi/3))^n,n=0:10 w=linspace(-4*pi,4*pi,1000); xw=zeros(size(w)); for n=0:10, xw=xw+exp(-j*w*n)*(0.9*exp(j*pi/3))^n; end subplot(2,1,1); plot(w/pi,abs(xw));title('|x(\omega)|');grid on subplot(2,1,2); plot(w/pi,angle(xw));title('Phase of x(\omega)');grid on
>> w=0:0.001:pi; >> magH=1./sqrt(1.81-1.8*cos(w)); >> angH=-atan2(0.9*sin(w),1-0.9*cos(w)); >> subplot(2,1,1); plot(w/pi,magH);title('Magniture repsonse');grid on >> subplot(2,1,2); plot(w/pi,angH);title('Phase repsonse');grid on
FREQZ Digital filter frequency response. [H,W] = FREQZ(B,A,N) returns the N-point complex frequency response vector H and the N-point frequency vector W in radians/sample of the filter: given numerator and denominator coefficients in vectors B and A. The frequency response is evaluated at N points equally spaced around the upper half of the unit circle. If N isn't specified, it defaults to 512. [H,W] = FREQZ(B,A,N,'whole') uses N points around the whole unit circle. H = FREQZ(B,A,W) returns the frequency response at frequencies designated in vector W, in radians/sample (normally between 0 and pi). [H,F] = FREQZ(B,A,N,Fs) and [H,F] = FREQZ(B,A,N,'whole',Fs) return frequency vector F (in Hz), where Fs is the sampling frequency (in Hz). H = FREQZ(B,A,F,Fs) returns the complex frequency response at the frequencies designated in vector F (in Hz), where Fs is the sampling frequency (in Hz).
>> b=[0.0181, 0.0543,0.0543,0.0181]; >> a=[1,-1.76,1.1829,-0.2781]; >> [H,W]=freqz(b,a); >> subplot(2,1,1); plot(W/pi,abs(H));title('Magnitude repsonse');grid on >> subplot(2,1,2); plot(W/pi,angle(H));title('Phase repsonse');grid on