Lyx 2.0 and onwards on OS X will use spellchecker provided by the OS X. Note however that the language it will use for spellchecking is determined by the document's language setting, not your system language setting.

Furthermore, in version 2.0.3, if you change your document's language setting, you have to close and re-open the document before it takes effect.

Cheers,

Steve

## April 28, 2012

## April 23, 2012

### Notes on RF-0417C

Some notes on using the popular Bluetooth serial module RF-0417C:

- When sending AT commands, do not include \r\n either together or singly.
- It appears to be happy to receive 5V inputs to TX.
- It is
*not*happy to receive 5V to Vcc. - If you connect a LED, it blinks when unpaired, blinks slightly faster when paired, and becomes solid when a serial connection is established.
- It works just fine with the SoftwareSerial library.

Cheers,

Steve

## April 18, 2012

### DFT and the Window Spectrum

In case I forget again why the window spectrum is computed when doing DFT, the answer is that discretisation leads to aliasing artefacts.

Consider the DFT of a x(t)=1. Its DFT is calculated by calculating the sum sin(2 pi f t)*x(t) and cos(2 pi f t)*x(t) individually, then squaring the resulting sums, add them together, then take the square root. Since x(t) = 1, for any frequency you are essentially summing cos(t) and sin(t), which you expect to be zero, and thus the power spectrum should be 0 for any frequency.

If you actually do this with, you will find that unless the points in time where sampling occurs covers an integer number of wavelengths, and is coherent in phase, i.e. sampling occurs in the same phase of each cycle, you will find that you don't get 0. You might get 0.1, 0.15, 0.09, 0.01, etc, but not 0. This is made more obvious by non-uniformely sampled data, such as those you might get in the real world.

This present a problem: the residue can produces peaks where there would otherwise be none, and this is more pronounced for lower frequency, because their wavelengths are longer and thus less likely to fit perfectly inside the window.

One way of rectifying this issue is to compute a correction coefficient c(f)=1-w(f) where f is the frequency, w(f) the window spectrum. The "corrected" power spectrum can then be calculated as correctp(f) = p(f) * c(f), where p(f) is the power spectrum.

I should add that the above method is not at all mathematical. It is chosen because any correction strategy that involves dividing by w(f) is unstable as sometimes w(f) gets very close to 0. Simply subtracting w(f) from p(f) won't work either because p(f)'s magnitude clearly depends on x(t) whereas w(f) doesn't.

An obvious failure of the above correction is that it doesn't make the residue disappear - it only reduces it. A superior method would correct the DFT for a DC signal so it is 0 everywhere.

The obvious answer is to simply normalise x(t) so the maximum amplitude is 1.0. Then the window power can simply be subtracted. Duh.

Cheers,

Steve

Consider the DFT of a x(t)=1. Its DFT is calculated by calculating the sum sin(2 pi f t)*x(t) and cos(2 pi f t)*x(t) individually, then squaring the resulting sums, add them together, then take the square root. Since x(t) = 1, for any frequency you are essentially summing cos(t) and sin(t), which you expect to be zero, and thus the power spectrum should be 0 for any frequency.

If you actually do this with, you will find that unless the points in time where sampling occurs covers an integer number of wavelengths, and is coherent in phase, i.e. sampling occurs in the same phase of each cycle, you will find that you don't get 0. You might get 0.1, 0.15, 0.09, 0.01, etc, but not 0. This is made more obvious by non-uniformely sampled data, such as those you might get in the real world.

This present a problem: the residue can produces peaks where there would otherwise be none, and this is more pronounced for lower frequency, because their wavelengths are longer and thus less likely to fit perfectly inside the window.

One way of rectifying this issue is to compute a correction coefficient c(f)=1-w(f) where f is the frequency, w(f) the window spectrum. The "corrected" power spectrum can then be calculated as correctp(f) = p(f) * c(f), where p(f) is the power spectrum.

I should add that the above method is not at all mathematical. It is chosen because any correction strategy that involves dividing by w(f) is unstable as sometimes w(f) gets very close to 0. Simply subtracting w(f) from p(f) won't work either because p(f)'s magnitude clearly depends on x(t) whereas w(f) doesn't.

An obvious failure of the above correction is that it doesn't make the residue disappear - it only reduces it. A superior method would correct the DFT for a DC signal so it is 0 everywhere.

**Update**The obvious answer is to simply normalise x(t) so the maximum amplitude is 1.0. Then the window power can simply be subtracted. Duh.

Cheers,

Steve

Subscribe to:
Posts (Atom)