码迷,mamicode.com
首页 > 其他好文 > 详细

《DSP using MATLAB》Problem 2.5

时间:2017-12-02 17:51:52      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:images   today   art   --   dsp   highlight   hit   and   nbsp   

技术分享图片

2、代码:

%% ------------------------------------------------------------------------
%%            Output Info about this m-file
fprintf(‘\n***********************************************************\n‘);
fprintf(‘        <DSP using MATLAB> Problem 2.5.2 \n\n‘);

time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, ‘long‘);
fprintf(‘      Now is %20s, and it is %7s  \n\n‘, time_stamp, wkd2);
%% ------------------------------------------------------------------------

n1 = -100; n2 = 100;
n = [n1:n2];
x = exp(0.1* j * pi* n);
%x = cos(0.1 * n);

set(gcf,‘Color‘,‘white‘); 
stem(n,x); title(‘exp(0.1j\pi n) Sequence‘);
xlabel(‘n‘); ylabel(‘x(n)‘); grid on;

figure
set(gcf,‘Color‘,‘white‘); 
stem(n,real(x)); title(‘exp(0.1j\pi n) Real Part Sequence‘);
xlabel(‘n‘); ylabel(‘Real[x(n)]‘); grid on;

figure
set(gcf,‘Color‘,‘white‘); 
stem(n,imag(x)); title(‘exp(0.1j\pi n) Imaginary Part Sequence‘);
xlabel(‘n‘); ylabel(‘Imag[x(n)]‘); grid on;

figure
set(gcf,‘Color‘,‘white‘); 
stem(n,abs(x)); title(‘exp(0.1j\pi n) Magnitude Sequence‘);
xlabel(‘n‘); ylabel(‘|x(n)|‘); grid on;

figure
set(gcf,‘Color‘,‘white‘); 
stem(n,(180/pi) * angle(x)); title(‘exp(0.1j\pi n) Phase Sequence‘);
xlabel(‘n‘); ylabel(‘phase[x(n)]‘); grid on;

  运行结果:

技术分享图片

技术分享图片

技术分享图片

技术分享图片

 

3、代码:

%% ------------------------------------------------------------------------
%%            Output Info about this m-file
fprintf(‘\n***********************************************************\n‘);
fprintf(‘        <DSP using MATLAB> Problem 2.5.3 \n\n‘);

time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, ‘long‘);
fprintf(‘      Now is %20s, and it is %7s  \n\n‘, time_stamp, wkd2);
%% ------------------------------------------------------------------------

n1 = -20; n2 = 20;
n = [n1:n2];
%x = exp(0.1* j * pi* n);
x = cos(0.1 * n);

set(gcf,‘Color‘,‘white‘); 
stem(n,x); title(‘cos(0.1n) Sequence‘);
xlabel(‘n‘); ylabel(‘x(n)‘); grid on;

  运行结果:

技术分享图片

 

《DSP using MATLAB》Problem 2.5

标签:images   today   art   --   dsp   highlight   hit   and   nbsp   

原文地址:http://www.cnblogs.com/ky027wh-sx/p/7954659.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!