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: Kavya Manohar
Subject: Re: FM modulation of a sqarewave carrier with sinusoidal message in gnu-octave
Date: Fri, 30 May 2014 09:43:24 +0530


Mike,


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.

Thanks a lot. I missed out this concept while coding.

 

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

I tried out the modified code and it did work well. Thanks again.

Kavya.

reply via email to

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