Wednesday, November 17, 2010

0

matlab program for sine wave generation(Continous and discrete)

  • Wednesday, November 17, 2010
  • tech
  • Share
  • Program

    % continous sine wave
    t=0:.1:10;                                   %create an array t 
    a=input('enter the amplitude');
    f=input('enter the frequency');
    y=a*sin(2*pi*f*t);                      %calculation of sine wave
    plot(t,y);                                     %plot the value of t against y
    title('continous sinewave');      % title of the graph
    xlabel('time');
    ylabel('amplitude');



    output





    % discrete sine wave
    clc;                                         %clear command window
    t=0:.1:10;                               %create an array t starting from 0 and .1 is the increment and 10 final value
    a=input('enter the amplitude');
    f=input('enter the frequency');
    y=a*sin(2*pi*f*t);                    %calculation of sine wave
    stem(t,y);                                 %discrete plot the value of t against y
    title('discrete sinewave');         % title of the graph
    xlabel('time');
    ylabel('amplitude');



    OUTPUT


    0 Responses to “matlab program for sine wave generation(Continous and discrete)”

    Post a Comment