Quality factor calculation

 User
 Posts: 2
 Joined: Wed Jun 07, 2017 7:42 pm
Quality factor calculation
Is there a formula for math channels to calculate the quality factor of an oscillator?

 User
 Posts: 2
 Joined: Wed Jun 07, 2017 7:42 pm
Re: Quality factor calculation
This is probably too complicated for math channels. Could this be added to the feature request list for the "Add measurement" toolbox?

 User
 Posts: 2
 Joined: Wed Jun 07, 2017 7:42 pm
Re: Quality factor calculation
Any update on de feature request for Qfactor measurement?
Example: https://www.giangrandi.ch/electronics/r ... osceq.png
Example: https://www.giangrandi.ch/electronics/r ... osceq.png
Re: Quality factor calculation
Hi Karl,
Sorry for the delay in responding. The answer to this post required quite a bit of work, so I had to wait until I could set aside some time to do it. As the derivation of a Damping Coefficient or Qualityfactor is used in so many aspects of Engineering and Science, I had to agree that we should have some means of being able to calculate these parameters within our tools.
There are many different documented methods for deriving a Damping Coefficient or Qfactor from calculation, all with relatively nontrivial mathematical descriptions of damped oscillations, but you can simplify the calculation significantly by using the 'Ring Down' Method (for a mathematical description of how this can be simplified to the Ring Down Method, go here: https://www.giangrandi.ch/electronics/r ... ownq.shtml). However, for good enough accuracy the Qfactor needs to be at least 10 (as mentioned on page 3 of this NASA document, where they refer to the 'damping factor' and provide an equation to convert that to Quality factor: https://core.ac.uk/download/pdf/83529588.pdf). So the equation Q=4.5323*N (where N is the number of cycles between the time at the starting voltage and the time when the voltage has decayed to half the starting value) may be accurate enough (depending upon your requirements) as resonators should have a Qfactor of > 10.
In the Ring Down method link there are examples using an old cathode ray oscilloscope which restricts the measurement to just visual analysis. With PicoScopes we have the added advantage of additional software tools for much more precise analysis. There are errors, when implementing the method described in the Ring Down link, because the amplitude and location in time of the half height endpoint is likely to be an estimate, rather than an actual measurement. For best accuracy, you really need to be using values that sit precisely on the envelope of the decaying waveform, which you can't do with the older CRO because of it's limitations, and the fact that the envelope is not actually captured or displayed. The examples at the end of this post highlight the typical errors you will get when estimating the halfheight end point for different Qfactors.
Improving Accuracy
If the previously mentioned errors are unacceptable then, in order to be able to make more accurate measurements, we really need a method that only expresses the Qfactor in terms of the distance between whole periods of the oscillating waveform. If we restrict the measurement points to the waveform peaks, we can make use of the fact that the selected measurement points sit on the envelope of the waveform. We can select the 2 measurement points as being [1] the highest peak (at, or near, the waveform start) to [2] another peak, approximately halfway down from the highest peak. Voltage and Time measurements for the half height endpoint will then be accurate because we are using another peak, which is actually on the envelope of the waveform, and we will be performing the calculation with whole cycle intervals.
Note also that for best accuracy the equation for the envelope should really be:
v(t) = v[t=0]*e^(ω*t[elapsed time since v{max}]/2*Q ) * cos(ωt + θ )
However, as we are using the peaks, θ = 0, and cos((ωt + θ) = 1, so the cosine term can be ignored.
So, to rearrange the equation for whole cycle intervals:
v(t) = v(t=0)*e^(ω*t[Nτ]/2Q)
where:
v(t) is the voltage at the current point in time (i.e. at the measurement endpoint),
v(t=0) is the voltage at the maximum starting value (i.e. at the measurement startpoint),
t(Nτ) is the time interval between the measurement startpoint and the measurement endpoint
N*τ is the number of cycles between the start and end points multiplied by the period of the oscillating waveform
(So, t(Nτ) = N*τ)
Rearranging the equation we have:
v(t) / v(t=0) = e^(ω*t[Nτ]/2Q)
ln( v(t) / v(t=0) ) =  ω*t[Nτ]/2Q
ln( v(t=0) / v(t) ) = ω*t[Nτ]/2Q
and:
Q =
2*π*f*t[Nτ]
2*ln( v(t=0) / v(t) )
Q =
π*f*t[Nτ] (1)
ln( v(t=0) / v(t) )
Q =
π*f*N*(1/f)
ln( v(t=0) / v(t) )
Q =
π*N (2)
ln( v(t=0) / v(t) )
Both numbered equations are accurate, but equation (2) is a simpler method, especially when using automatic counting (see example 3), and waveform peaks as start and end points (see example 1 & 2)
So, from the equation (1), we have 2 voltage measurements a time measurement and a frequency measurement to make, which will give us the Qfactor. The frequency measurement can be set up as an automatic measurement, as can the voltage measurement at v(t=0) by using the absolute peak (or maximum level) of the waveform. The time between the 2 peaks can be measured with the 2 Time rulers, and the endpoint peak with 1 Channel ruler.
For equation (2), we have 1 automatic voltage measurement, just 1 amplitude measurement with a ruler and 1 cycle count. The following examples demonstrate using these methods.
Example 1
As shown in the data file and image file, 'Example 1  Qfactor accurate measurement' below: the number of waveform cycles are counted. So, using the approximate calculation from the 1st link above, the Qfactor is:
4.5323*35 = 158.63
Also in the data file and image file, the values for the voltages in equation (2) are measured.
Using the more accurate method of equation 2, the Qfactor is:
3.1416 * 35
ln( 907.7 / 450.8 )
= 157.10, so the estimation error was almost 1% (0.97%)
Example 2
As shown in the data file and (this time with a zoomed in view) image file, 'Example 2  Qfactor accurate measurement' below:
the number of waveform cycles are again counted. So again, using the approximate calculation, the Qfactor is:
4.5323*11 = 49.855
The measured voltages and more accurate calculation gives a Qfactor of:
3.1416 * 11
ln( 898.9 / 461.5 )
= 51.834, so here the estimation error is 3.8%
Example 3
Finally, in the data file 'Example 3  Qfactor accurate measurement' below:
the Qfactor is so high that it's just not practical to count cycles, however, what we can do is use the measurement tool to automatically count edges for the time interval between the measurement startpoint and the measurement endpoint, by placing both Time rulers at those locations and measuring between them, as shown in the image files 'Example 3  Qfactor accurate measurement  start point measurement  zoomed in', and 'Example 3  Qfactor accurate measurement  end point measurement' below.
So, this time, as there is no estimate of the number of cycles to be made, I have placed the Channel Ruler at exactly half of the maximum height (i.e. half of the 1st peak of 814.3mV, which, is shown in the image file 'Example 3  Qfactor accurate measurement  zoomed out' below:
and if you zoom in to the data file, you will see is at 407.15mV) which happens to be approximately halfway between 2 peaks, on the Time axis, as shown in the above '...end point measurement' image file.
So, as we need to count using only whole cycles, for a count that includes a halfcycle, we can just use edges (i.e. 2 edges per cycle) and then divide them by 2 to get the cycle count, which gives a Qfactor of:
3.1416 * 693/2
ln( 814.3 / 407.15 )
= 1,570.5
We could also use an alterative slightly more accurate method (slightly, because the errors of cycle number estimation reduce as the Qfactor increases because the distance between peaks reduces) this time, using the actual time interval between the measurement startpoint and the measurement endpoint, then multiplying by the automatic measured frequency, as shown in equation (1) above and the image file 'Example 3  Qfactor accurate measurement  alternative values to use' below:
This gives a Qfactor of:
3.1416 * 34.65*10^(3) * 9999
ln( 814.3 / 407.15 )
= 1,570.3, so, the edge counting estimation error is 0.013%.
However, the error was deliberately introduced to show the results of estimation if the edges had been manually counted (in order to demonstrate how much the error is reduced at this high Qfactor value, in comparison to the previous lower Qfactor examples). Under normal circumstances for a valid measurement, you would place the endpoint ruler at a waveform peak, so that the edge counting would be as accurate as the time & frequency measurement.
Summary
To answer your original questions, there is no way to perform a Math Channel calculation for Qfactor. So, as you requested, I will add a feature request for it. In the meantime, as shown, there is a quick, simple count that can be made for a simple calculation of the Q factor with minor errors, or alternatively you can use slightly longer (but still quick and simple) measurements to determine the values to use in more accurate calculations of Qfactor.
Regards,
Gerry
Sorry for the delay in responding. The answer to this post required quite a bit of work, so I had to wait until I could set aside some time to do it. As the derivation of a Damping Coefficient or Qualityfactor is used in so many aspects of Engineering and Science, I had to agree that we should have some means of being able to calculate these parameters within our tools.
There are many different documented methods for deriving a Damping Coefficient or Qfactor from calculation, all with relatively nontrivial mathematical descriptions of damped oscillations, but you can simplify the calculation significantly by using the 'Ring Down' Method (for a mathematical description of how this can be simplified to the Ring Down Method, go here: https://www.giangrandi.ch/electronics/r ... ownq.shtml). However, for good enough accuracy the Qfactor needs to be at least 10 (as mentioned on page 3 of this NASA document, where they refer to the 'damping factor' and provide an equation to convert that to Quality factor: https://core.ac.uk/download/pdf/83529588.pdf). So the equation Q=4.5323*N (where N is the number of cycles between the time at the starting voltage and the time when the voltage has decayed to half the starting value) may be accurate enough (depending upon your requirements) as resonators should have a Qfactor of > 10.
In the Ring Down method link there are examples using an old cathode ray oscilloscope which restricts the measurement to just visual analysis. With PicoScopes we have the added advantage of additional software tools for much more precise analysis. There are errors, when implementing the method described in the Ring Down link, because the amplitude and location in time of the half height endpoint is likely to be an estimate, rather than an actual measurement. For best accuracy, you really need to be using values that sit precisely on the envelope of the decaying waveform, which you can't do with the older CRO because of it's limitations, and the fact that the envelope is not actually captured or displayed. The examples at the end of this post highlight the typical errors you will get when estimating the halfheight end point for different Qfactors.
Improving Accuracy
If the previously mentioned errors are unacceptable then, in order to be able to make more accurate measurements, we really need a method that only expresses the Qfactor in terms of the distance between whole periods of the oscillating waveform. If we restrict the measurement points to the waveform peaks, we can make use of the fact that the selected measurement points sit on the envelope of the waveform. We can select the 2 measurement points as being [1] the highest peak (at, or near, the waveform start) to [2] another peak, approximately halfway down from the highest peak. Voltage and Time measurements for the half height endpoint will then be accurate because we are using another peak, which is actually on the envelope of the waveform, and we will be performing the calculation with whole cycle intervals.
Note also that for best accuracy the equation for the envelope should really be:
v(t) = v[t=0]*e^(ω*t[elapsed time since v{max}]/2*Q ) * cos(ωt + θ )
However, as we are using the peaks, θ = 0, and cos((ωt + θ) = 1, so the cosine term can be ignored.
So, to rearrange the equation for whole cycle intervals:
v(t) = v(t=0)*e^(ω*t[Nτ]/2Q)
where:
v(t) is the voltage at the current point in time (i.e. at the measurement endpoint),
v(t=0) is the voltage at the maximum starting value (i.e. at the measurement startpoint),
t(Nτ) is the time interval between the measurement startpoint and the measurement endpoint
N*τ is the number of cycles between the start and end points multiplied by the period of the oscillating waveform
(So, t(Nτ) = N*τ)
Rearranging the equation we have:
v(t) / v(t=0) = e^(ω*t[Nτ]/2Q)
ln( v(t) / v(t=0) ) =  ω*t[Nτ]/2Q
ln( v(t=0) / v(t) ) = ω*t[Nτ]/2Q
and:
Q =
2*π*f*t[Nτ]
2*ln( v(t=0) / v(t) )
Q =
π*f*t[Nτ] (1)
ln( v(t=0) / v(t) )
Q =
π*f*N*(1/f)
ln( v(t=0) / v(t) )
Q =
π*N (2)
ln( v(t=0) / v(t) )
Both numbered equations are accurate, but equation (2) is a simpler method, especially when using automatic counting (see example 3), and waveform peaks as start and end points (see example 1 & 2)
So, from the equation (1), we have 2 voltage measurements a time measurement and a frequency measurement to make, which will give us the Qfactor. The frequency measurement can be set up as an automatic measurement, as can the voltage measurement at v(t=0) by using the absolute peak (or maximum level) of the waveform. The time between the 2 peaks can be measured with the 2 Time rulers, and the endpoint peak with 1 Channel ruler.
For equation (2), we have 1 automatic voltage measurement, just 1 amplitude measurement with a ruler and 1 cycle count. The following examples demonstrate using these methods.
Example 1
As shown in the data file and image file, 'Example 1  Qfactor accurate measurement' below: the number of waveform cycles are counted. So, using the approximate calculation from the 1st link above, the Qfactor is:
4.5323*35 = 158.63
Also in the data file and image file, the values for the voltages in equation (2) are measured.
Using the more accurate method of equation 2, the Qfactor is:
3.1416 * 35
ln( 907.7 / 450.8 )
= 157.10, so the estimation error was almost 1% (0.97%)
Example 2
As shown in the data file and (this time with a zoomed in view) image file, 'Example 2  Qfactor accurate measurement' below:
the number of waveform cycles are again counted. So again, using the approximate calculation, the Qfactor is:
4.5323*11 = 49.855
The measured voltages and more accurate calculation gives a Qfactor of:
3.1416 * 11
ln( 898.9 / 461.5 )
= 51.834, so here the estimation error is 3.8%
Example 3
Finally, in the data file 'Example 3  Qfactor accurate measurement' below:
the Qfactor is so high that it's just not practical to count cycles, however, what we can do is use the measurement tool to automatically count edges for the time interval between the measurement startpoint and the measurement endpoint, by placing both Time rulers at those locations and measuring between them, as shown in the image files 'Example 3  Qfactor accurate measurement  start point measurement  zoomed in', and 'Example 3  Qfactor accurate measurement  end point measurement' below.
So, this time, as there is no estimate of the number of cycles to be made, I have placed the Channel Ruler at exactly half of the maximum height (i.e. half of the 1st peak of 814.3mV, which, is shown in the image file 'Example 3  Qfactor accurate measurement  zoomed out' below:
and if you zoom in to the data file, you will see is at 407.15mV) which happens to be approximately halfway between 2 peaks, on the Time axis, as shown in the above '...end point measurement' image file.
So, as we need to count using only whole cycles, for a count that includes a halfcycle, we can just use edges (i.e. 2 edges per cycle) and then divide them by 2 to get the cycle count, which gives a Qfactor of:
3.1416 * 693/2
ln( 814.3 / 407.15 )
= 1,570.5
We could also use an alterative slightly more accurate method (slightly, because the errors of cycle number estimation reduce as the Qfactor increases because the distance between peaks reduces) this time, using the actual time interval between the measurement startpoint and the measurement endpoint, then multiplying by the automatic measured frequency, as shown in equation (1) above and the image file 'Example 3  Qfactor accurate measurement  alternative values to use' below:
This gives a Qfactor of:
3.1416 * 34.65*10^(3) * 9999
ln( 814.3 / 407.15 )
= 1,570.3, so, the edge counting estimation error is 0.013%.
However, the error was deliberately introduced to show the results of estimation if the edges had been manually counted (in order to demonstrate how much the error is reduced at this high Qfactor value, in comparison to the previous lower Qfactor examples). Under normal circumstances for a valid measurement, you would place the endpoint ruler at a waveform peak, so that the edge counting would be as accurate as the time & frequency measurement.
Summary
To answer your original questions, there is no way to perform a Math Channel calculation for Qfactor. So, as you requested, I will add a feature request for it. In the meantime, as shown, there is a quick, simple count that can be made for a simple calculation of the Q factor with minor errors, or alternatively you can use slightly longer (but still quick and simple) measurements to determine the values to use in more accurate calculations of Qfactor.
Regards,
Gerry
Gerry
Technical Specialist
Technical Specialist

 User
 Posts: 2
 Joined: Wed Jun 07, 2017 7:42 pm
Re: Quality factor calculation
Hi Gerry, Thank you for your elaborate answer to my seemingly simple question. Great job. I did not know this turned out to be such a complicated measurement. I am looking forward to putting the quality factor measurement to the test.