美文网首页
Sinusoidal Signals on Matlab

Sinusoidal Signals on Matlab

作者: Nino_Lau | 来源:发表于2019-03-14 15:09 被阅读0次

    Problem 1

    Question Description

    Write a Matlab program to plot a continuous-time sinusoidal signal and its sampled version, and verify. (You need to use the hold function to keep both plots.)

    Matlab Implementation

    
    % f = 3Hz
    T=1;
    t=0:0.01:T;
    F=sin(2*pi*t*f);
    plot(t,F,'LineWidth',1);
    title('Sinusoidal Signal','FontSize',18);
    xlabel('t');
    ylabel('F(t)');
    hold on;
    
    % f = 7Hz
    f=7; 
    T=1;
    t=0:0.01:T;
    F=sin(2*pi*t*f);
    plot(t,F,'LineWidth',1);
    title('Sinusoidal Signal','FontSize',18);
    xlabel('t');
    ylabel('F(t)');
    hold on;
    
    % f = 13Hz
    f=13; 
    T=1;
    t=0:0.01:T;
    F=sin(2*pi*t*f);
    plot(t,F,'LineWidth',1);
    title('Sinusoidal Signal','FontSize',18);
    xlabel('t');
    ylabel('F(t)');
    hold off;
    

    Experiment Results

    image

    Problem 2

    Question Description

    Using the program developed in the previous problem, verify experimentally that the family of continuous-time sinusoids.

    Matlab Implementation

    % f = 3Hz
    f0 = 2;
    FT = 50;
    d = 1;
    A = 1;
    k = input('k = ');
    omega0 = 2*pi*f0;
    omegaT = 2*pi*FT;
    
    % Signal k = -1
    t = 0:0.001:1;
    g1 = A*cos(omega0*t+d+k*omegaT*t);
    subplot(2,1,1)
    plot(t,g1,'b-')
    xlabel('t');
    ylabel('amp');
    hold
    n = 0:1:FT;
    gs = A*cos(omega0*n/FT+d+k*omegaT*n/FT);
    plot(n/FT,gs,'ro');
    hold 
    
    % Signal k = 2
    k = input('k = ');
    t = 0:0.001:1;
    g1 = A*cos(omega0*t+d+k*omegaT*t)
    subplot(2,1,2)
    plot(t,g1,'b-')
    xlabel('t')
    ylabel('amp')
    hold
    n = 0:1:FT;
    gs = A*cos(omega0*n/FT+d+k*omegaT*n/FT);
    plot(n/FT,gs,'ro');
    hold off
    

    Experiment Results

    image

    From the two subplots, we can see that the shapes of red circles are same. Thus, the family of continuous-time sinusoids are verified.

    相关文章

      网友评论

          本文标题:Sinusoidal Signals on Matlab

          本文链接:https://www.haomeiwen.com/subject/vdzqmqtx.html