On 1 Apr, 16:11, "Ron N." <rhnlo...@yahoo.com> wrote:
> The edge of the half-aperture-sized rectangular window in the
> middle in still visible. To reduce the "leakage" from this
> sharp transition (in frequency or slope), you might try
> separately windowing each frequency burst (a half size window
> in your example) and then summing, rather than summing and
> then windowing the full aperture.
Awesome Ron, I think I'm beginning to understand!
The input consists of two 5s rectangular windows in series, so they
generate sinc() functions with zero crossing points every 0.2Hz in the
FFT, not every 0.1Hz as I had been assuming until now (ie. because the
total data length is 10s). Because my FFT is set up for 0.1Hz bin
spacings, every bin corresponding to an even multiple of 0.1Hz lies on
one of the 0.2Hz zero crossing locations of the sinc (so gives no
response - or a response at -300dB in my simulator), but the odd
multiples of 0.1Hz don't lie on these zero crossings and so they have
a response from the sinc which is much higher, at around -30dB.
So I guess I could just throw away every bin which corresponds to an
odd multiple of 0.1Hz - I loose half my resolution, but I then get a
clean FFT. Is this the correct way to do things?
I'll need to think about things a bit more before I'm completely
happy, and I think I'll try the analytical autocorrelation analysis
Tim mentions, but I think I now understand why the sinc function is
visible in my FFT!
Cheers!
Ted
Reply by Tim Wescott●April 1, 20082008-04-01
On Mon, 31 Mar 2008 15:58:18 -0700, Ted T wrote:
> Hi,
>
> I'm looking at FSK modulation in matlab, using my own modulator as I
> don't have the matlab comms toolbox. In the time domain, the signal
> looks fine, but in the frequency domain, it just doesn't seem to work, I
> get lots of other garbage in the spectrum. I'm hoping someone can see an
> error in my ways...
>
> First, the time axis is 10 seconds sampled at 20Hz ie:
>
> t = 0:1/20:((200/20)-(1/20));
>
> Next, the FSK setup, the signal has two tones: 1Hz and 4Hz. First we
> produce one tone for 5 seconds (corresponding to some number of digital
> 0 symbols in our input data stream), and then the second tone for 5
> seconds (corresponding to the same number of digital 1 symbols). The FSK
> modulator output can be calculated using (a simplification, which shows
> the same problem):
>
> f = zeros(1,200);
> f(1:100) = 1;
> f(101:200) = 4;
> signal = sin(2*pi*f.*t);
>
> Finally, the FFT setup is 0.1Hz resolution with a maximum frequency of
> 10Hz, so I'm using 200 samples (as above). My inputs are a multiples of
> 0.1Hz to ensure the zero crossings of the sinc() response of the
> rectangular windowed data lie on the bin locations, so I compute the FFT
> and the results show lots of noise:
> http://picasaweb.google.co.uk/teddythornton/UntitledAlbum/
photo#5184042339233679394
>
> I'm not sure whether the problem lies with my FSK modulation scheme
> (although in the time domain it exactly matches what I sketch out on
> paper), or my FFT setup. To try and eliminate the FFT setup as the
> problem, I changed my input signal to two tones added together (instead
> of different tones at different times), ie:
>
> signal = sin(2*pi*1*t) + sin(2*pi*4*t);
>
> If I FFT this, it looks perfect - clean to -300dB:
> http://picasaweb.google.co.uk/teddythornton/UntitledAlbum/
photo#5184042339233679410
>
> So I think my FFT setup is OK, but the FSK modulation looks OK too, so I
> can't see what the problem is... Any ideas??
>
> Thanks,
>
> Ted
This is pretty much what Eric said, only worded differently:
You're not holding your mouth right when you look at the first plot.
What you should expect to see is a pair of sinc signals, one centered on
1Hz and one centered on 4Hz. It appears that that is, indeed, what
you're seeing.
As mentioned in another thread recently, what you _really_ need to do to
get a spectral plot of modulated data is a _long_ string of _randomly_
modulated data, followed by some bin averaging.
Better, in my mind, if you can do it, is to calculate the expected value
of the autocorrelation function of your data on paper (you just can't do
it experimentally) and take the Fourier transform of that. Assuming that
your modulation scheme is amenable to analysis, you should only go to
actual data when you start verifying your modulation software.
--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com
Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
Reply by Ron N.●April 1, 20082008-04-01
On Apr 1, 6:36 am, Ted T <teddythorn...@googlemail.com> wrote:
> Hi Steve,
>
> On Apr 1, 11:06 am, Steve Underwood <ste...@dis.org> wrote:
>
> > Try just putting a single tone into your FFT.
>
> Done: t = 0:1/20:((200/20)-(1/20); signal = sin(2*pi*4*t);
> (ie. a 4Hz input signal)
>
> The fft of this, using the same FFT setup as previously:http://picasaweb.google.co.uk/teddythornton/UntitledAlbum/photo#51842...
>
> Clean to -300dB, the noise floor of my simulator (Octave), I think.
>
> > Without windowing of the
> > time domain data you will see a similar horrible mess of sidelobes.
>
> I thought you didn't need windowing if you have a periodic signal and
> you have an exact integer number of cycles of your signal in your
> window.
If a sinusoid is exactly periodic in the FFT aperture, then
the signal will be bin centered. But if the length of the
rectangular window on your data is not the same as that of
the FFT aperture, then the main lobe will be fatter than two
bin widths, and thus the side-lobes will no longer be zero.
> Sure, this is hard (impossible) to arrange for in a real
> system, but them I'm just calculating things in theory using matlab,
> so I have arranged for this. Then you are effectively applying a
> "rectangular" window, which has a sinc() response in the frequency
> domain, but the sinc() response has zero crossings at +/- 2n*pi/(tau)
> (n=1,2,...), where (tau) is the width (in time) of your rectangular
> window. So if you set your bin spacing equal to 1/(tau), the zero
> crossings of the sinc() function exactly match the other bin
> locations, and no sidelobes are observed in the output spectrum.
>
> > What
> > you are seeing has little to do with the FSK signal you have produced.
> > It is just artifacts of misapplying the FFT. Try applying, say, a
> > Hamming window to the data before feeding it into the FFT. You should
> > see those sidelobes go way down, and the real signal come into view.
>
> I tried with a hamming window and a blackman window but (surprisingly)
> there is absolutely no difference between either of these and the
> original FFT of the FSK signal, with no windowing. I could show you
> the graph if you like, but it is absolutely identical to the first
> graph in my first post above. Perhaps this is something to do with the
> zero crossing setup of my FFT again, meaning that the windows have no
> contribution to the spectrum.
The edge of the half-aperture-sized rectangular window in the
middle in still visible. To reduce the "leakage" from this
sharp transition (in frequency or slope), you might try
separately windowing each frequency burst (a half size window
in your example) and then summing, rather than summing and
then windowing the full aperture.
IMHO. YMMV.
--
rhn A.T nicholson d.0.t C-o-M
http://www.nicholson.com/rhn/dsp.html
Reply by Ted T●April 1, 20082008-04-01
Hi Steve,
On Apr 1, 11:06 am, Steve Underwood <ste...@dis.org> wrote:
> Without windowing of the
> time domain data you will see a similar horrible mess of sidelobes.
I thought you didn't need windowing if you have a periodic signal and
you have an exact integer number of cycles of your signal in your
window. Sure, this is hard (impossible) to arrange for in a real
system, but them I'm just calculating things in theory using matlab,
so I have arranged for this. Then you are effectively applying a
"rectangular" window, which has a sinc() response in the frequency
domain, but the sinc() response has zero crossings at +/- 2n*pi/(tau)
(n=1,2,...), where (tau) is the width (in time) of your rectangular
window. So if you set your bin spacing equal to 1/(tau), the zero
crossings of the sinc() function exactly match the other bin
locations, and no sidelobes are observed in the output spectrum.
> What
> you are seeing has little to do with the FSK signal you have produced.
> It is just artifacts of misapplying the FFT. Try applying, say, a
> Hamming window to the data before feeding it into the FFT. You should
> see those sidelobes go way down, and the real signal come into view.
I tried with a hamming window and a blackman window but (surprisingly)
there is absolutely no difference between either of these and the
original FFT of the FSK signal, with no windowing. I could show you
the graph if you like, but it is absolutely identical to the first
graph in my first post above. Perhaps this is something to do with the
zero crossing setup of my FFT again, meaning that the windows have no
contribution to the spectrum.
Thanks for your comments!
Ted
Reply by Steve Underwood●April 1, 20082008-04-01
Ted T wrote:
> Hi Ron,
>
>> You can see the effect of the rectangular window by
>> zeroing either the first of second half of your data
>> vector before doing an FFT.
>
> Interesting, I suppose this is exactly what is shown in the first plot
> above, as it is just the superposition of two sinusoids which have
> half of their data zeroed (perhaps this is your point?). And that
> garbage does look like side-lobes (as Eric mentions below).
>
> In my comms book it doesn't mention anything about side lobes - just
> that FSK will produce two main lobes centered at f1 and f2 with width
> 1/To. Does this mean that FSK fundamentally produces side-lobes when
> analyzed with the FFT? So if I practically implemented the modulator
> and analyzed the output with a filterbank-based spectrum analyzer, I
> would see what my comms book says?
>
> I just want to make sure that my setup is correct before I start
> adding noise modelling to my communication channel, so that I can see
> the impact of the noise sources and not have the results contaminated
> by a poor FSK/FFT setup.
>
> Thanks for the replies, they're very helpful!
>
> Ted
Try just putting a single tone into your FFT. Without windowing of the
time domain data you will see a similar horrible mess of sidelobes. What
you are seeing has little to do with the FSK signal you have produced.
It is just artifacts of misapplying the FFT. Try applying, say, a
Hamming window to the data before feeding it into the FFT. You should
see those sidelobes go way down, and the real signal come into view.
Steve
Reply by Ted T●April 1, 20082008-04-01
Hi Ron,
> You can see the effect of the rectangular window by
> zeroing either the first of second half of your data
> vector before doing an FFT.
Interesting, I suppose this is exactly what is shown in the first plot
above, as it is just the superposition of two sinusoids which have
half of their data zeroed (perhaps this is your point?). And that
garbage does look like side-lobes (as Eric mentions below).
In my comms book it doesn't mention anything about side lobes - just
that FSK will produce two main lobes centered at f1 and f2 with width
1/To. Does this mean that FSK fundamentally produces side-lobes when
analyzed with the FFT? So if I practically implemented the modulator
and analyzed the output with a filterbank-based spectrum analyzer, I
would see what my comms book says?
I just want to make sure that my setup is correct before I start
adding noise modelling to my communication channel, so that I can see
the impact of the noise sources and not have the results contaminated
by a poor FSK/FFT setup.
Thanks for the replies, they're very helpful!
Ted
Reply by Eric Jacobsen●March 31, 20082008-03-31
On Mon, 31 Mar 2008 15:58:18 -0700 (PDT), Ted T
<teddythornton@googlemail.com> wrote:
>Hi,
>
>I'm looking at FSK modulation in matlab, using my own modulator as I
>don't have the matlab comms toolbox. In the time domain, the signal
>looks fine, but in the frequency domain, it just doesn't seem to work,
>I get lots of other garbage in the spectrum. I'm hoping someone can
>see an error in my ways...
>
>First, the time axis is 10 seconds sampled at 20Hz ie:
>
>t = 0:1/20:((200/20)-(1/20));
>
>Next, the FSK setup, the signal has two tones: 1Hz and 4Hz. First we
>produce one tone for 5 seconds (corresponding to some number of
>digital 0 symbols in our input data stream), and then the second tone
>for 5 seconds (corresponding to the same number of digital 1 symbols).
>The FSK modulator output can be calculated using (a simplification,
>which shows the same problem):
>
>f = zeros(1,200);
>f(1:100) = 1;
>f(101:200) = 4;
>signal = sin(2*pi*f.*t);
>
>Finally, the FFT setup is 0.1Hz resolution with a maximum frequency of
>10Hz, so I'm using 200 samples (as above). My inputs are a multiples
>of 0.1Hz to ensure the zero crossings of the sinc() response of the
>rectangular windowed data lie on the bin locations, so I compute the
>FFT and the results show lots of noise:
>http://picasaweb.google.co.uk/teddythornton/UntitledAlbum/photo#5184042339233679394
>
>I'm not sure whether the problem lies with my FSK modulation scheme
>(although in the time domain it exactly matches what I sketch out on
>paper), or my FFT setup. To try and eliminate the FFT setup as the
>problem, I changed my input signal to two tones added together
>(instead of different tones at different times), ie:
>
>signal = sin(2*pi*1*t) + sin(2*pi*4*t);
>
>If I FFT this, it looks perfect - clean to -300dB:
>http://picasaweb.google.co.uk/teddythornton/UntitledAlbum/photo#5184042339233679410
>
>So I think my FFT setup is OK, but the FSK modulation looks OK too, so
>I can't see what the problem is... Any ideas??
>
>Thanks,
>
>Ted
Yes, the rectangular "window" on the symbols, i.e., the pulse shape,
is causing the sidelobes you see in the first plot. I'd suggest that
looking at something less than 300dB of dynamic range will be more
useful as you go on, as that's about 200dB more than people typically
care about. ;)
In other words, even the first plot isn't looking all that bad.
Eric Jacobsen
Minister of Algorithms
Abineau Communications
http://www.ericjacobsen.org
Reply by Ron N.●March 31, 20082008-03-31
On Mar 31, 3:58 pm, Ted T <teddythorn...@googlemail.com> wrote:
> Hi,
>
> I'm looking at FSK modulation in matlab, using my own modulator as I
> don't have the matlab comms toolbox. In the time domain, the signal
> looks fine, but in the frequency domain, it just doesn't seem to work,
> I get lots of other garbage in the spectrum. I'm hoping someone can
> see an error in my ways...
>
> First, the time axis is 10 seconds sampled at 20Hz ie:
>
> t = 0:1/20:((200/20)-(1/20));
>
> Next, the FSK setup, the signal has two tones: 1Hz and 4Hz. First we
> produce one tone for 5 seconds (corresponding to some number of
> digital 0 symbols in our input data stream), and then the second tone
> for 5 seconds (corresponding to the same number of digital 1 symbols).
> The FSK modulator output can be calculated using (a simplification,
> which shows the same problem):
>
> f = zeros(1,200);
> f(1:100) = 1;
> f(101:200) = 4;
> signal = sin(2*pi*f.*t);
>
> Finally, the FFT setup is 0.1Hz resolution with a maximum frequency of
> 10Hz, so I'm using 200 samples (as above). My inputs are a multiples
> of 0.1Hz to ensure the zero crossings of the sinc() response of the
> rectangular windowed data lie on the bin locations, so I compute the
> FFT and the results show lots of noise:http://picasaweb.google.co.uk/teddythornton/UntitledAlbum/photo#51840...
>
> I'm not sure whether the problem lies with my FSK modulation scheme
> (although in the time domain it exactly matches what I sketch out on
> paper), or my FFT setup. To try and eliminate the FFT setup as the
> problem, I changed my input signal to two tones added together
> (instead of different tones at different times), ie:
>
> signal = sin(2*pi*1*t) + sin(2*pi*4*t);
>
> If I FFT this, it looks perfect - clean to -300dB:http://picasaweb.google.co.uk/teddythornton/UntitledAlbum/photo#51840...
>
> So I think my FFT setup is OK, but the FSK modulation looks OK too, so
> I can't see what the problem is... Any ideas??
Common FFT usage Misconception #1
The main problem is with your expectation of seeing
the spectrum of an unwindowed sinusoid when taking
the FFT of a rectangularly windowed sinusoid. What
you are seeing isn't noise, it's the transform of
your rectangular window convolved with the transform
of your two sinusoids.
You can see the effect of the rectangular window by
zeroing either the first of second half of your data
vector before doing an FFT.
IMHO. YMMV.
--
rhn A.T nicholson d.0.t C-o-M
Reply by Ted T●March 31, 20082008-03-31
Hi,
I'm looking at FSK modulation in matlab, using my own modulator as I
don't have the matlab comms toolbox. In the time domain, the signal
looks fine, but in the frequency domain, it just doesn't seem to work,
I get lots of other garbage in the spectrum. I'm hoping someone can
see an error in my ways...
First, the time axis is 10 seconds sampled at 20Hz ie:
t = 0:1/20:((200/20)-(1/20));
Next, the FSK setup, the signal has two tones: 1Hz and 4Hz. First we
produce one tone for 5 seconds (corresponding to some number of
digital 0 symbols in our input data stream), and then the second tone
for 5 seconds (corresponding to the same number of digital 1 symbols).
The FSK modulator output can be calculated using (a simplification,
which shows the same problem):
f = zeros(1,200);
f(1:100) = 1;
f(101:200) = 4;
signal = sin(2*pi*f.*t);
Finally, the FFT setup is 0.1Hz resolution with a maximum frequency of
10Hz, so I'm using 200 samples (as above). My inputs are a multiples
of 0.1Hz to ensure the zero crossings of the sinc() response of the
rectangular windowed data lie on the bin locations, so I compute the
FFT and the results show lots of noise:
http://picasaweb.google.co.uk/teddythornton/UntitledAlbum/photo#5184042339233679394
I'm not sure whether the problem lies with my FSK modulation scheme
(although in the time domain it exactly matches what I sketch out on
paper), or my FFT setup. To try and eliminate the FFT setup as the
problem, I changed my input signal to two tones added together
(instead of different tones at different times), ie:
signal = sin(2*pi*1*t) + sin(2*pi*4*t);
If I FFT this, it looks perfect - clean to -300dB:
http://picasaweb.google.co.uk/teddythornton/UntitledAlbum/photo#5184042339233679410
So I think my FFT setup is OK, but the FSK modulation looks OK too, so
I can't see what the problem is... Any ideas??
Thanks,
Ted