DSP using MATLAB 示例Example3.1 3.2 3.3

上代码:

w = [0:1:500]*pi/500;    % [0,pi] axis divided into 501 points.
X = exp(j*w) ./ (exp(j*w) - 0.5*ones(1,501));

magX = abs(X); angX = angle(X); realX = real(X); imagX = imag(X);

set(gcf,‘Color‘,‘white‘);
subplot(2,2,1); plot(w/pi,magX); grid on;
title(‘Magnitude Part‘);
xlabel(‘frequency in \pi units‘); ylabel(‘Magnitude‘);
subplot(2,2,3); plot(w/pi, angX); grid on;
title(‘Angle Part‘);
xlabel(‘frequency in \pi units‘); ylabel(‘Radians‘);
subplot(‘2,2,2‘); plot(w/pi, realX); grid on;
title(‘Real Part‘);
xlabel(‘frequency in \pi units‘); ylabel(‘Real‘);
subplot(‘2,2,4‘); plot(w/pi, imagX); grid on;
title(‘Imaginary Part‘);
xlabel(‘frequency in \pi units‘); ylabel(‘Imaginary‘);

运行结果:

  

时间: 2024-10-20 23:07:35

DSP using MATLAB 示例Example3.1 3.2 3.3的相关文章

DSP using MATLAB 示例Example3.21

代码: % Discrete-time Signal x1(n) % Ts = 0.0002; n = -25:1:25; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*abs(nTs)); Ts = 0.001; n = -5:1:5; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*abs(nTs)); % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = x * sinc(Fs*

DSP using MATLAB示例Example3.18

代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Continuous-time Fourier Transform Wmax = 2*pi*2000; K = 500; k = 0:1:K; % index array k for frequencies W = k*Wmax/K; % freqency between 0 and +pi, [0,pi] axis divided i

DSP using MATLAB 示例 Example3.19

代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Discrete-time Signal Ts = 0.0002; n = -25:1:25; x = exp(-1000*abs(n*Ts)); % Discrete-time Fourier Transform %Wmax = 2*pi*2000; K = 500; k = 0:1:K; w = pi*k/K; % index ar

DSP using MATLAB示例Example3.16

代码: b = [0.0181, 0.0543, 0.0543, 0.0181]; % filter coefficient array b a = [1.0000, -1.7600, 1.1829, -0.2781]; % filter coefficient array a m = 0:length(b)-1; l = 0:length(a)-1; % index arrays m and l K = 500; k = 0:1:K; % index array k for frequenci

DSP using MATLAB 示例 Example3.15

上代码: subplot(1,1,1); b = 1; a = [1, -0.8]; n = [0:100]; x = cos(0.05*pi*n); y = filter(b,a,x); figure('NumberTitle', 'off', 'Name', 'Input and Output sequence'); set(gcf,'Color','white'); subplot(2,1,1); stem(n,x); title('Input sequence'); xlabel('n'

DSP using MATLAB 示例Example3.17

DSP using MATLAB示例Example3.6

代码: n = [-5:5]; x = (-0.9).^n; % x(n) = k = -200:200; w = (pi/100)*k; % [0,pi] axis divided into 101 points. X = x * (exp(-j*pi/100)) .^ (n'*k); magX = abs(X); angX = angle(X); realX = real(X); imagX = imag(X); set(gcf,'Color','white'); subplot(2,2,1

DSP using MATLAB 示例Example3.9

用到的性质 上代码: n = 0:100; x = cos(pi*n/2); k = -100:100; w = (pi/100)*k; % freqency between -pi and +pi , [0,pi] axis divided into 101 points. X = x * (exp(-j*pi/100)) .^ (n'*k); % DTFT of x % signal multiplied y = exp(j*pi*n/4) .* x; % signal multiplied

DSP using MATLAB 示例Example3.7

上代码: x1 = rand(1,11); x2 = rand(1,11); n = 0:10; alpha = 2; beta = 3; k = 0:500; w = (pi/500)*k; % [0,pi] axis divided into 501 points. X1 = x1 * (exp(-j*pi/500)) .^ (n'*k); % DTFT of x1 X2 = x2 * (exp(-j*pi/500)) .^ (n'*k); % DTFT of x2 x = alpha *