Write code using MATLAB for AM waveform and signal

Discussion in 'Programmer's Corner' started by kufarid, Dec 28, 2011.

  1. kufarid

    Thread Starter New Member

    Dec 28, 2011
    1
    0
    Hi! Guys. I have 2 questions.

    How to write a code using MATLAB to create:
    1) a full AM waveform with a modulation index of less than 1, 1 and greater than 1?
    2) a signal with frequency harmonics of 1, 3, 5 and nearly infinity?

    Thank you.
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,649
    2,348
  3. codehead

    Member

    Nov 28, 2011
    56
    11
    It's unclear whether you don't know how to do 1 and 2, or whether you don't know how to do them in MATLAB. I don't think anyone's going to write you MATLAB code from scratch—even if they are that charitable, your needs are vague so it would be a fuzzy target—though they might help take a look at your code if you're having trouble.

    Bertus answered #1; for #2, it's not clear whether you want all these harmonics at once, or want some kind of control over how many at once. And you don't say if there is an amplitude or phase relationship between them (do you want a square wave?). Basically, you just add up sine waves in a loop, and put it in a table if it's going to be static. Otherwise, you might want to build it with an inverse FFT. As far as "near infinity", you can only go to just under half the sample rate.
     
Loading...