help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FM modulation of a sqarewave carrier with sinusoidal message in gnu-


From: Mike Miller
Subject: Re: FM modulation of a sqarewave carrier with sinusoidal message in gnu-octave
Date: Thu, 29 May 2014 10:04:43 -0400

On Thu, May 29, 2014 at 17:38:10 +0530, Kavya Manohar wrote:
> I have used the code mentioned there in octave to implement frequency
> modulation with sinusoidal message and square wave carrier. But the
> resultant FM waveform has a frequency which is not proportional to the
> message signal amplitude.

I'm copying the relevant section of your code here for the benefit of
others following along:

  x_max=max(x);
  x_modulating=x./x_max;
  fdev=x_modulating*fc/2;
  fc=fc*ones(size(t));
  z=5.*square(2*pi*((fc+fdev).*t));

It's close but not quite frequency modulation. Check the definition
again, and remember that the argument to the sin or square function is
a phase vector. When the frequency is constant, the phase is simply
fc*t, but when you have a variable instantaneous frequency, you have
to integrate it over time. In discrete time this can be done with
cumsum(fdev)/Fs.

So what you want is probably something more like

  z = square (2*pi*fc.*t + 2*pi*cumsum(fdev)/Fs);

You can also look at the fmmod function in the Octave Forge
communications package.

HTH,

-- 
mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]