# Bode plots

**Bode plots**, a forum discussion on Cleverscope Mixed Signal USB Oscilloscopes. Join us for more discussions on

*Bode plots*on our Questions forum.

Back to Forum Index : Back to Questions |

**mkajdas**

23 Mar 2007

Posts:

I have some questions about bode plots.

I was able to get some bode plots but:

- the spectrum graph has two options above the graph to select freq. span and resolution and they do not line up with my gen. sweep. The bode plot looks more like many bins (peaks) between the real values and -100dB. Is there a way to adjust freq. parameters to match gen. sweep points?

- what is the algorigthm for freq. span and freq. resolution relationship? There are very few choices for the resolution and they seem to be divisibles of something.

- is there a way to specify exact freq. range for the bode/spectrum graph?

- is there a way to specify phase range of the graph? I would like to see phase as -180 to +180 instead of what Cleverscope decides (-/+ 200)

Martin

I was able to get some bode plots but:

- the spectrum graph has two options above the graph to select freq. span and resolution and they do not line up with my gen. sweep. The bode plot looks more like many bins (peaks) between the real values and -100dB. Is there a way to adjust freq. parameters to match gen. sweep points?

- what is the algorigthm for freq. span and freq. resolution relationship? There are very few choices for the resolution and they seem to be divisibles of something.

- is there a way to specify exact freq. range for the bode/spectrum graph?

- is there a way to specify phase range of the graph? I would like to see phase as -180 to +180 instead of what Cleverscope decides (-/+ 200)

Martin

**mkajdas**

23 Mar 2007

Posts:

I also have similar questions regarding freq. spectrum graphs and one more:

- the freq. spectrum graph varies a lot depending on a freq. resulution selected (which makes sense) but the resolution choices are few and not very good for what I am trying to see.

Because of that I do not really know if what I am seeing is real or not.

Can I change freq. resolution to a better suited value?

How is it supposedto be used with the choices that are available (freq. spectrum and bode)?

Martin

- the freq. spectrum graph varies a lot depending on a freq. resulution selected (which makes sense) but the resolution choices are few and not very good for what I am trying to see.

Because of that I do not really know if what I am seeing is real or not.

Can I change freq. resolution to a better suited value?

How is it supposedto be used with the choices that are available (freq. spectrum and bode)?

Martin

**bartschroder**

24 Mar 2007

Posts: 427

Hello Martin,

First I will explain what an FFT based spectrum analyzer does (which is different than a tracking narrow band swept spectrum analyser). Using an FFT spectrum analyzer, a sample set of n samples is used to generate a frequency domain of n/2 +1 frequency bins. The lowest frequency bin is always DC, and the highest frequency bin is always the sampling frequency divided by 2. The cleverscope always samples at 100 MSPS, provided the scope graph width is less than 20 ms (or 40 ms for the 8MSa version). The acquisition unit includes a built in decimator that can pick out samples at regular intervals, including peak detection for intermediate samples if required. The spectrum decimator does not use peak detection. Thus sample intervals must be a factor of 10ns. We can therefore offer effective sampling periods of 10ns, 20ns, 30ns.. which corresponds to Frequency spans of 1/(2*ts) or 50 Mhz, 25 Mhz, 16.665 Mhz, 12.5 Mhz... The minimum frequency you can resolve is 1/scope graph time width. So if the scope graph is 20ms wide, the resolution is 50 Hz.

We offer sample sizes for spectrum analysis of 1024, 2048, 4096, 8192 or 16384 samples. We use a power of 2 sample set to keep the FFT fast. With a set of n samples, you get n/2 frequency bins. Thus with 1024 samples, you get 512 frequency bins. With a 50 Hz resolution, your lowest frequency span is 50 x 512 = 25.6 kHz. Now in our scope we do some rounding to make the Frequency Span numbers go in the standard 1,2,2.5,5 sequence. Underneath, there will be a little variance from this, but that is not important, the numbers will be correct.

So, given a particular scope graph time width, Cleverscope offers all available frequency spans from the minimum available to the maximum supported by the peak effective sample rate. (If you sample with a scope graph 1 second wide for example, the effective peak sample rate is 1/2000000 = 500ns. This yields a peak frequency span of 1 MHz. Cleverscope will offers all the frequency spans from 500 Hz..1MHz that correspond to this scope graph time width). We can offer no more frequency spans than we do!

Secondly the available frequency resolutions are equal to using 1024, 2048, 4096, 8192 or 16384 samples in each FFT set. Most people find this set of frequency resolutions good enough. But for the hardy few, we may increase the number at some point.

So that is how we arrive at the Frequency Span and Resolution set provided.

Now there is another component to the whole spectrum measurement system. Essentially an FFT analyser assumes that the signal continues on for ever in both directions (+ and - time), and that the sample set fully represents the signal you are looking at. Now this is actually wrong - first, it is sampled, meaning you can miss out on the information between samples, and secondly the endpoints of the sample set might not match up correctly from one side of the sample set to the other. This will generate discontinuities that contain frequency information that is not actually there. For this reason we (and all other FFT analysers) use a 'window' to smooth the edges to zero. The window is carefully chosen to ensure out of band (ie above Fs/2) frequency components generated are very low. The windowing process however does reduce the frequency resolution by spreading out the frequency bins somewhat. This spreading factor can easily be seen by looking at a single frequency signal (such as a sine wave) and varying the window used. The user manual includes a discussion of the window types available and which signals they should be applied to (page 49 of v2.4), and how much spreading occurrs.

Now with a little thought you can see that each frequency bin is centered on a multiple of the resolution. Say the resolution was 50 Hz, then the frequency bins will be at 0, 50, 100, 150, 200.. Fs/2 Hz. If you measure a frequency that is not at a multiple of 50 Hz, you will not be on the peak of the bin frequency response, but off to one side, and will therefore report an amplitude that is lower than actual. The error will be dependant on the type of window used, and the spreading factor. Wider spreading factors reduce the error, but at the expense of frequency accuracy. Conventional spectrum analysers have exactly the same problem (because of the internal filter banks or their digital equivalent), and use terms such as quasi-peak to describe averaging processes they use. The solution if you want an accurate pass band response is to use signal generator frequencies that are multiples of the frequency resolution.

Cleverscope lets you do this with the signal generator - you set the Sweep Method to Sweep Synchronous Autostep. You must have the spectrum graph open, and have sampled something for the signal generator to know what the auto-step should be. When in Autostep, the signal generator examines the spectrum graph span and resolution, and calculates the correct step to place all the generated frequencies at multiples of the frequency bin size. In addition, the signal generator will step synchronously - that is, only between acquisitions. This ensures that there is no frequency change (and hence frequency smearing) during the acquisition. When you sample with auto-step, the amplitude error will be very small (less than 0.01 dB), and you can be certain that what you are measuring is actually there. In addition the autostep automatically calculates the spacing needed to ensure full coverage on the bode plot - which will eliminate the sperate frequency components you currently see. Note that the finer you make the frequency resolution, the more steps you will require, which will slow down the scan rate (the scan rate is set by the acquisition rate - usually 16 frames/sec. Thus if you have a frequency resolution equivalent to 8192 bins, you will need to make 8192 measurements to cover the whole frequency span, or 512 seconds scan duration). To get a full frequency response, the standard frequency resolution (top most item on the frequency span drop down list) is usually sufficient, and will yield a faster step time (32 seconds for a full bandwidth scan). Mostly you don't scan the full bandwidth - just the bit you are interested in.

Ok, with all this in mind (a little rest might be useful!), here are the answers to your questions:

1. The frequency span and resolution are as described above. You can use auto-step to guarantee full coverage. If you just want to do a quick sweep to get an approximate idea, set the Freq Step value on the sig gen control quite wide, and mentally fill in the blanks.

2. The frequency range measured by the FFT is fixed as described above. You can off course vary the spectrum graph frequency axis to look at just the frequency range of interest. You can also set the signal generator to scan just this range, saving on step time. As an example say you wanted to look at the frequency range 10-12 kHz. You might set a frequency span of 25 kHz (assuming no out-of-band components), and then set the frequency graph to show 10-12 kHz. Set the signal generator base frequency to 10 kHz, and the Frequency Range to 2 kHz. Use a sine wave. Use synchronous with auto step sweep method. Set up your bode plot manually to display the gain and phase axis the way you want them. Select peak averaging (Settings/Averaging). Select averaging on (cleverscope control panel). Select triggered to start sampling. Click on Start Sweep on the signal generator control panel. The sweep from 10-12 kHz starts, and you should see the bode plot for this range.

3. You have complete control of what the phase axis on the bode plot shows. Just adjust the B side using the buttons as normal. You can choose to plot from -180 to +180 degrees or 0-360 degs (Unwrap phase selected on Settings/Spectrum... dialog).

4. You say the frequency graph choices are few, and yet you have complete control of what frequency range you look at (remember you can grab the graph using the hand tool, and move it exactly where you want), and a range of resolutions. So please tell us what you are trying to see.

5. What you are seeing is as real as you can get (the same applies to any spectrum analyser) for the reasons explained above. You can be certain that at the bin centers the amplitude is correct. Off the bin centers there is some negative error. By choosing the appropriate window and signal generator frequency step you can minimize these errors. When measuring the spectrum of a real signal, in which all frequencies are present, the measured spectrum is very close to reality.

Perhaps you could give a specific example of your application, and what you are trying to do, and then we can advise on how best to use Cleverscope.

First I will explain what an FFT based spectrum analyzer does (which is different than a tracking narrow band swept spectrum analyser). Using an FFT spectrum analyzer, a sample set of n samples is used to generate a frequency domain of n/2 +1 frequency bins. The lowest frequency bin is always DC, and the highest frequency bin is always the sampling frequency divided by 2. The cleverscope always samples at 100 MSPS, provided the scope graph width is less than 20 ms (or 40 ms for the 8MSa version). The acquisition unit includes a built in decimator that can pick out samples at regular intervals, including peak detection for intermediate samples if required. The spectrum decimator does not use peak detection. Thus sample intervals must be a factor of 10ns. We can therefore offer effective sampling periods of 10ns, 20ns, 30ns.. which corresponds to Frequency spans of 1/(2*ts) or 50 Mhz, 25 Mhz, 16.665 Mhz, 12.5 Mhz... The minimum frequency you can resolve is 1/scope graph time width. So if the scope graph is 20ms wide, the resolution is 50 Hz.

We offer sample sizes for spectrum analysis of 1024, 2048, 4096, 8192 or 16384 samples. We use a power of 2 sample set to keep the FFT fast. With a set of n samples, you get n/2 frequency bins. Thus with 1024 samples, you get 512 frequency bins. With a 50 Hz resolution, your lowest frequency span is 50 x 512 = 25.6 kHz. Now in our scope we do some rounding to make the Frequency Span numbers go in the standard 1,2,2.5,5 sequence. Underneath, there will be a little variance from this, but that is not important, the numbers will be correct.

So, given a particular scope graph time width, Cleverscope offers all available frequency spans from the minimum available to the maximum supported by the peak effective sample rate. (If you sample with a scope graph 1 second wide for example, the effective peak sample rate is 1/2000000 = 500ns. This yields a peak frequency span of 1 MHz. Cleverscope will offers all the frequency spans from 500 Hz..1MHz that correspond to this scope graph time width). We can offer no more frequency spans than we do!

Secondly the available frequency resolutions are equal to using 1024, 2048, 4096, 8192 or 16384 samples in each FFT set. Most people find this set of frequency resolutions good enough. But for the hardy few, we may increase the number at some point.

So that is how we arrive at the Frequency Span and Resolution set provided.

Now there is another component to the whole spectrum measurement system. Essentially an FFT analyser assumes that the signal continues on for ever in both directions (+ and - time), and that the sample set fully represents the signal you are looking at. Now this is actually wrong - first, it is sampled, meaning you can miss out on the information between samples, and secondly the endpoints of the sample set might not match up correctly from one side of the sample set to the other. This will generate discontinuities that contain frequency information that is not actually there. For this reason we (and all other FFT analysers) use a 'window' to smooth the edges to zero. The window is carefully chosen to ensure out of band (ie above Fs/2) frequency components generated are very low. The windowing process however does reduce the frequency resolution by spreading out the frequency bins somewhat. This spreading factor can easily be seen by looking at a single frequency signal (such as a sine wave) and varying the window used. The user manual includes a discussion of the window types available and which signals they should be applied to (page 49 of v2.4), and how much spreading occurrs.

Now with a little thought you can see that each frequency bin is centered on a multiple of the resolution. Say the resolution was 50 Hz, then the frequency bins will be at 0, 50, 100, 150, 200.. Fs/2 Hz. If you measure a frequency that is not at a multiple of 50 Hz, you will not be on the peak of the bin frequency response, but off to one side, and will therefore report an amplitude that is lower than actual. The error will be dependant on the type of window used, and the spreading factor. Wider spreading factors reduce the error, but at the expense of frequency accuracy. Conventional spectrum analysers have exactly the same problem (because of the internal filter banks or their digital equivalent), and use terms such as quasi-peak to describe averaging processes they use. The solution if you want an accurate pass band response is to use signal generator frequencies that are multiples of the frequency resolution.

Cleverscope lets you do this with the signal generator - you set the Sweep Method to Sweep Synchronous Autostep. You must have the spectrum graph open, and have sampled something for the signal generator to know what the auto-step should be. When in Autostep, the signal generator examines the spectrum graph span and resolution, and calculates the correct step to place all the generated frequencies at multiples of the frequency bin size. In addition, the signal generator will step synchronously - that is, only between acquisitions. This ensures that there is no frequency change (and hence frequency smearing) during the acquisition. When you sample with auto-step, the amplitude error will be very small (less than 0.01 dB), and you can be certain that what you are measuring is actually there. In addition the autostep automatically calculates the spacing needed to ensure full coverage on the bode plot - which will eliminate the sperate frequency components you currently see. Note that the finer you make the frequency resolution, the more steps you will require, which will slow down the scan rate (the scan rate is set by the acquisition rate - usually 16 frames/sec. Thus if you have a frequency resolution equivalent to 8192 bins, you will need to make 8192 measurements to cover the whole frequency span, or 512 seconds scan duration). To get a full frequency response, the standard frequency resolution (top most item on the frequency span drop down list) is usually sufficient, and will yield a faster step time (32 seconds for a full bandwidth scan). Mostly you don't scan the full bandwidth - just the bit you are interested in.

Ok, with all this in mind (a little rest might be useful!), here are the answers to your questions:

1. The frequency span and resolution are as described above. You can use auto-step to guarantee full coverage. If you just want to do a quick sweep to get an approximate idea, set the Freq Step value on the sig gen control quite wide, and mentally fill in the blanks.

2. The frequency range measured by the FFT is fixed as described above. You can off course vary the spectrum graph frequency axis to look at just the frequency range of interest. You can also set the signal generator to scan just this range, saving on step time. As an example say you wanted to look at the frequency range 10-12 kHz. You might set a frequency span of 25 kHz (assuming no out-of-band components), and then set the frequency graph to show 10-12 kHz. Set the signal generator base frequency to 10 kHz, and the Frequency Range to 2 kHz. Use a sine wave. Use synchronous with auto step sweep method. Set up your bode plot manually to display the gain and phase axis the way you want them. Select peak averaging (Settings/Averaging). Select averaging on (cleverscope control panel). Select triggered to start sampling. Click on Start Sweep on the signal generator control panel. The sweep from 10-12 kHz starts, and you should see the bode plot for this range.

3. You have complete control of what the phase axis on the bode plot shows. Just adjust the B side using the buttons as normal. You can choose to plot from -180 to +180 degrees or 0-360 degs (Unwrap phase selected on Settings/Spectrum... dialog).

4. You say the frequency graph choices are few, and yet you have complete control of what frequency range you look at (remember you can grab the graph using the hand tool, and move it exactly where you want), and a range of resolutions. So please tell us what you are trying to see.

5. What you are seeing is as real as you can get (the same applies to any spectrum analyser) for the reasons explained above. You can be certain that at the bin centers the amplitude is correct. Off the bin centers there is some negative error. By choosing the appropriate window and signal generator frequency step you can minimize these errors. When measuring the spectrum of a real signal, in which all frequencies are present, the measured spectrum is very close to reality.

Perhaps you could give a specific example of your application, and what you are trying to do, and then we can advise on how best to use Cleverscope.

**mkajdas**

27 Mar 2007

Posts:

Thank you for the detailed explonation.

I think you should add this to the manual because the manual does not even mention the freq. span and freq. resolution options (I think I have the latest manual).

I am trying to do several things:

- get a bode plot of an audio amplifier from 1Hz to 200kHz, using built-in sig. gen. I did not use auto-step and that was probably my biggest mistake.

- get a spectrum analysis of the same amplifier at 1kHz

I always used Frequency Response Analyzers for bode plots before and never had to deal with FFT issues.

I was able to select any freq. or sweep and received perfect readings.

I am trying to do the same now with Cleverscope without understanding FFT at all.

I also need to get bode plots of some high freq. radio filters (0.5 and 10MHZ) and amplifiers so that I can adjust them for proper freq. response.

Any suggestions to my two applications would be appreciated.

Martin

I think you should add this to the manual because the manual does not even mention the freq. span and freq. resolution options (I think I have the latest manual).

I am trying to do several things:

- get a bode plot of an audio amplifier from 1Hz to 200kHz, using built-in sig. gen. I did not use auto-step and that was probably my biggest mistake.

- get a spectrum analysis of the same amplifier at 1kHz

I always used Frequency Response Analyzers for bode plots before and never had to deal with FFT issues.

I was able to select any freq. or sweep and received perfect readings.

I am trying to do the same now with Cleverscope without understanding FFT at all.

I also need to get bode plots of some high freq. radio filters (0.5 and 10MHZ) and amplifiers so that I can adjust them for proper freq. response.

Any suggestions to my two applications would be appreciated.

Martin

**bartschroder**

5 Apr 2007

Posts: 427

Hello Martin,

What you say is fair. We should build in a simple to use Bode Plot menu that does the configuration for you. I guess we started off from the point of view of an oscillsocope.

You can do the Bode plot for filters up to 10 Mhz using the built in Sig Gen. Above 10 MHz, you are going to have to use an external sig gen, and manually sweep it.

For your particular applications, for the 1 to 200 kHz applications, I would set the sig gen to sweep with a base frequency of 1 kHz, sweeping 199 kHz, synchronous auto-step, and set the frequency span to 200 Khz. All other steps as I described above. For the 0.5 Mhz filter, the same steps for the frequency range you want, and also the same for the 10 Mhz filter.

Hope this helps.

What you say is fair. We should build in a simple to use Bode Plot menu that does the configuration for you. I guess we started off from the point of view of an oscillsocope.

You can do the Bode plot for filters up to 10 Mhz using the built in Sig Gen. Above 10 MHz, you are going to have to use an external sig gen, and manually sweep it.

For your particular applications, for the 1 to 200 kHz applications, I would set the sig gen to sweep with a base frequency of 1 kHz, sweeping 199 kHz, synchronous auto-step, and set the frequency span to 200 Khz. All other steps as I described above. For the 0.5 Mhz filter, the same steps for the frequency range you want, and also the same for the 10 Mhz filter.

Hope this helps.

Back to Forum Index : Back to Questions |