首页 > 代码库 > DSP using Matlab 示例Example2.2

DSP using Matlab 示例Example2.2

技术分享

a、

n = -2:10; x = [1:7,6:-1:1];                % generate x(n)
[x11,n11] = sigshift(x,n,5); [x12,n12] = sigshift(x,n,-4);
[x1,n1] = sigadd(2 * x11, n11, -3 * x12, n12);

set(gcf,‘Color‘,[1,1,1])                  % 改变坐标外围背景颜色
stem(n,x); title(‘Sequence x(n)‘)
xlabel(‘n‘);ylabel(‘x(n)‘);
grid on

figure                                    % 新生成一张图
set(gcf,‘Color‘,[1,1,1])                  % 改变坐标外围背景颜色
stem(n1,x1); title(‘Sequence in Example 2.2a‘)
xlabel(‘n‘); ylabel(‘x1(n)‘);
grid on

技术分享

技术分享

 

b、

n = -2:10; x = [1:7,6:-1:1];                % generate x(n)
[x21,n21] = sigfold(x,n);    [x21,n21] = sigshift(x21,n21,3);
[x22,n22] = sigshift(x,n,2); [x22,n22] = sigmult(x,n,x22,n22);
[x2,n2] = sigadd(x21, n21, x22, n22);

% subplot(2,1,1);
set(gcf,‘Color‘,[1,1,1])                  % 改变坐标外围背景颜色
stem(n,x); title(‘Sequence x(n)‘)
xlabel(‘n‘);ylabel(‘x(n)‘);
grid on;

figure 
set(gcf,‘Color‘,‘white‘)                                   % 新生成一张图
stem(n2,x2); title(‘Sequence in Example 2.2b‘)
xlabel(‘n‘); ylabel(‘x2(n)‘);grid on;

技术分享  

技术分享

不足之处,欢迎批评指正。

  

 

DSP using Matlab 示例Example2.2