時域信號matlab實現


1、利用MATLAB的向量表示法繪制下列連續信號的時域波形。

     (1) x1(t) = u(t + 2) - u(t - 3)

     (2) x2(t) = cos(2πt + π/3)

     (3) x3(t) = (2exp(-t) - exp(-2t))u(t -1)

     (4) x4(t) = (0.2t - 2)u(t)
解: 建立階躍函數文件Ustep.m,

     則Ustep.m文件內容為:

     function f = Ustep(t)

     f = (t > 0);    %若t > 0,則階躍函數為1

     (1) t = -5:0.01:5;

          x1 = Ustep(t + 2) - Ustep(t - 3);

          plot(t,x1);

          axis([-5,5,-5,5]);

          

     (2) t = -3:0.1:3;

          x2 = cos(2*pi*t + pi/3);
          plot(t,x2);

 

      (3) t = 0:0.01:10;

          x3 = (2*exp(-t) - exp(-2*t)) .* Ustep(t - 1);

          plot(t,x3);

          

     (4) t = -3:0.01:3;

 

            x4 = (0.2*t - 2) .* Ustep(t);

 

            plot(t,x4);

 

            axis([-3,3,-2,2]);

 

 

2、利用MATLAB的符號運算功能繪制上題連續信號的時域波形。

解: 建立階躍函數文件Ustep.m,

     則Ustep.m文件內容為:

     function f = Ustep(t)

     f = (t > 0);    %若t > 0,則階躍函數為1

    (1) syms t;

         x1 = sym('Ustep(t + 2) - Ustep(t - 3)');

         ezplot(x1,-3,4);

    (2) syms t;

         x2 = sym('cos(2*pi*t + pi/3)');

         ezplot(t,x2,[-3,3]);

 

    (3) syms t;

          x3 = sym('(2*exp(-t) - exp(-2*t)) * Ustep(t - 1)');

          ezplot(x3,[0,10,0,0.7],1);

          

    (4) syms t;

         x4 = sym('(0.2 * t - 2) * Ustep(t)');

         ezplot(x4,[-3,3,-2,2],1);

 3、已知x(t) = Sa(t),試用MATLAB編程繪制下列信號的時域波形。

      (1) x1(t) = x(2 - 2t)

      (2) x2(t) = x(2t + 2)

      (3) x3(t) = x(0.5t - 1)

      (4) x4(t) = x(1 - 0.5t)

解: 建立階躍函數文件Ustep.m,

     則Ustep.m文件內容為:

     function f = Ustep(t)

     f = (t > 0);    %若t > 0,則階躍函數為1

(1) syms t;

     x1 = sym('sinc(2 - 2*t)');

     ezplot(x1,[-2,3,-2,2],1); 

(2) syms t;

     x2 = sym('sinc(2*t + 2)');

     ezplot(x1,[-2,3,-2,2],1);

(3) syms t;

     x3 = sym('sinc(0.5*t - 1)');

     ezplot(x3,[-10,10,-2,2],1);

(4) syms t;

     x4 = sym('sinc(1 - 0.5*t)');

     ezplot(x4,[-10,10,-2,2],1);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM