+ Post New Thread
Results 1 to 4 of 4
  1. #1
    Newbie level 2
    Points: 42, Level: 1

    Join Date
    Oct 2012
    Posts
    2
    Helped
    0 / 0
    Points
    42
    Level
    1

    please I need some help with this sinusoidal signal

    I try to generate a sinusoidal signal in matlab which is :

    Amplitude = 10

    Frequency = 100

    sample rate = 5000

    singal duration T = 1 sec

    initial phase = 0


    But does not come with me . Can any one help me with the code?

    Thanks

    •   Alt5th October 2012, 14:58

      advertising

        
       

  2. #2
    Advanced Member level 1
    Points: 7,213, Level: 20
    pakitos's Avatar
    Join Date
    Nov 2005
    Posts
    457
    Helped
    113 / 113
    Points
    7,213
    Level
    20

    Re: please I need some help with this sinusoidal signal

    %program to generate sine wave


    f= input('enter the frequency in hertz of the sine wave');
    t=0:.0001:5;
    y=sin(2*pi*f*t);
    plot(t,y);
    ylabel ('Amplitude');
    xlabel ('Time Index');
    TITLE ('Sine wave');


    %with samples

    t = [ 0 : 1 : 40 ]; % Time Samples
    f = 500; % Input Signal Frequency
    fs = 8000; % Sampling Frequency
    x = sin(2*pi*f/fs*t); % Generate Sine Wave
    figure(1);
    stem(t,x,'r'); % View the samples
    figure(2);
    stem(t*1/fs*1000,x,'r'); % View the samples
    hold on;
    plot(t*1/fs*1000,x); % Plot Sine Wave

    good luck


    1 members found this post helpful.

    •   Alt5th October 2012, 19:03

      advertising

        
       

  3. #3
    Newbie level 2
    Points: 42, Level: 1

    Join Date
    Oct 2012
    Posts
    2
    Helped
    0 / 0
    Points
    42
    Level
    1

    Re: please I need some help with this sinusoidal signal

    Quote Originally Posted by pakitos View Post
    %program to generate sine wave


    f= input('enter the frequency in hertz of the sine wave');
    t=0:.0001:5;
    y=sin(2*pi*f*t);
    plot(t,y);
    ylabel ('Amplitude');
    xlabel ('Time Index');
    TITLE ('Sine wave');


    %with samples

    t = [ 0 : 1 : 40 ]; % Time Samples
    f = 500; % Input Signal Frequency
    fs = 8000; % Sampling Frequency
    x = sin(2*pi*f/fs*t); % Generate Sine Wave
    figure(1);
    stem(t,x,'r'); % View the samples
    figure(2);
    stem(t*1/fs*1000,x,'r'); % View the samples
    hold on;
    plot(t*1/fs*1000,x); % Plot Sine Wave

    good luck
    thanks a lot for help

    but what about if I have like thses tow what I need to write in matlap so this function can work :

    1- Create a function using mat lab to generate a sinusoidal signal.
    The parameters of the signal should have an Amplitude = 100
    frequency = 100Hz
    initial phase = 0
    sample rate = 5000
    signal duration (T) = 1 sec.

    2- Add another sinusoid with frequency 1000 Hz and amplitude 100 to the one generated in 1. (All other parameters are the same). plot two cycles of the sum of the two signals in time.

    thanks a lot



    •   Alt7th October 2012, 06:49

      advertising

        
       

  4. #4
    Junior Member level 3
    Points: 399, Level: 4

    Join Date
    Apr 2011
    Location
    Bengaluru
    Posts
    25
    Helped
    2 / 2
    Points
    399
    Level
    4

    Re: please I need some help with this sinusoidal signal

    Please be specific regarding what is required, only then anyone can help you in generating the waveform. Also try out a few things yourself, we get to learn a lot when we try different things.



--[[ ]]--