HP 54502A Datasheet typo about AC coupling

The cutoff frequency of 10Hz on the datasheet is a typo. Better scopes at the time claims 90Hz. 10Hz is just too good to be true.

Found the specs from the service manual:

Don’t be fooled by the -3dB cutoff and ignore how wide the transition band can be (depends on the filter type and the order). Turns out this model has a very primitive filter that AC couple mode still messes square waves below 3kHz up despite the specs says the -3dB is at 90Hz. You better have a 30+ fold guard band for old scopes!

Remember square wave pulse train in time domain is basically a sinc pulse centered at every impulse of the impulse train in frequency domain superimposed. Unless you have a tiny duty cycle (which is not the case for uniform square waves, they are 50%), the left hand side of the sinc function at 1kHz fundamental still have sub-1kHz components that can be truncated by the AC coupling (high pass filter).

 19 total views

變幻才是永恆 = 世界是線性?

羅文唱的「家變」中的歌詞提及到「不必怨世時變,變幻才是永恆」,表達了一個很大膽的理論: 「世界是線性的」,這是學術界不可思議的一大奇聞。如果世事真的是線性,那麼股市只可以永遠不停地上升,下降,或停滯。從微積分學中,我們可以看到為何如此簡單的一句歌詞醞含著那麼大的玄機:

我們先以 f(x) 代表世界的事情, x 陣列代表可變的事物,K 是永恆不變的固定數,那麼世事變幻便是 f'(x)。「變幻才是永恆」亦即譯作 f'(x) = K,把恆等式的兩邊積分,我們便得到 f(x) = Kx + C,不用多說,C 當然是隨意常數。從此可見世界是線性方程式!

– Sep 17, 2005

 179 total views

Demystifying comparisons between eBay managed payments and the old way Hint: it's still the old final value fees (before cap) + payment processing fees (analogous to Paypal)

Most often when we sell on eBay, we receive Paypal payments, so we ended up paying eBay’s commissions (also called the final value fee, FVF for short) and Paypal processing fees as a percentage of the sale.

Now eBay pushes out Managed Payments (MP) which combines payment processing fees with the eBay commissions (FVF) because eBay now manages the payment gateway. The rest is every time you sell something, you get a payout (sales – fees) deposited directly to your bank (it used to be collecting paypal balances then withdraw it).

They have a different calculation formula which they claimed the sellers are better off in most cases, but should we take eBay’s word for it? Regardless of whether you are enrolled in managed payments, the fee percentage for each sale depends on:

  • eBay store subscription level
  • category

It’s impractical to do the side by side fee structure comparison to see when we are better off for each sale, plus we cannot easily switch between the two plans.

It’d be very helpful if we can put the managed payment fee structure on the same form as the conventional eBay+Paypal fee structure, and figure out under what conditions we are better off or worse off with managed payments.

Initially I was ready to do the derivations to put both plans on the same scale, but I spotted that managed payment (combined) percentage is simply the vanilla (non-managed) eBay category final value fee + 2.35% payment processing fees! That’s how they’ve calculated the combined managed payments percentage!

This makes life a lot easier. Since I can factor out the 2.35% that applies to the whole sum (which also include shipping and sales tax) regardless of the fee cap, this works exactly the same as Paypal (which charges 2.9%) and we are getting a 0.55% discount in payment processing fees.

For managed payments, since we’ve already separated out the payment processing fees, the fee cap applies to the vanilla final value fee portion which is equivalent to the old eBay final value fee. Keep that in mind.

The part that has changed is the fee cap. The old way caps the commissions/FVF directly regardless of product category, yet the new way (managed payments) caps the sale price that are charged commissions. This means the fee cap goes up or down a little depending on the final value fee percentage class applying to your sale.

eBay set the (commissioned) sale price cap to closely match the realized commission cap in the old way, for example non-store subscriber who will have their raw final value fees capped at $750 will see the same cap for the most common 10% categories (12.35%-2.35% = 10%) because the (commissioned) sale price cap is $7500, which $7500*10%=$750.

Big industrial equipment also have the same cap regardless because $15,000*2% = $300.

For non-store subscribers, 10% is the anchor (iso-fee-cap) category. So you are a little worse of with books (price cap +2%) and better off with musical instruments (price cap -6.5%). 

For store subscribers, you get a bit more break over the fee-cap (lower) because your final value fee percentage is lower than the anchor (likely they chose a breakeven point at 10% when determining the sales price to cap final value fee over. Just easy numbers, not rocket science):

Managed Conventional Discount*
Common (9.15%) $2,500*9.15% = $228.75 $350 (Small stores)
$250 (Big stores)
$121.25 (Small stores)
$21.25 (Big stores)
Heavy gears (1.5%) $15,000*1.5% = $225 $250 $25
Books (12%) $2,500*12% = $300 $350 (Small stores)
$250 (Big stores)
$50 (Small stores)
-$50 (Big stores worse off)
Guitars (3.5%) $2,500*3.5% = $87.5 $350 (Small stores)
$250 (Big stores)
$262.5 (Small stores)
$162.5 (Big stores)

I call Basic/Premium ‘small-stores’ and Anchor/Enterprise ‘big-stores’.

So here are the observations, which is all you need to know:

  • Under managed payments, small-stores gets a better deal than big-stores, because the advantage of the $100 lower fee cap with big stores are eliminated with variable fee caps.
  • The breakeven line for small stores ($350 cap) is 14% fees ($350/$2500), which the highest category is 12% so far. This means small-stores are ALWAYS better off switching to managed payments.
  • The breakeven line for big stores ($250 cap) is 10% fees ($250/$2500), which the only category above that right now is books (12%). Big-stores selling BOOKS are worse off with managed payments.

So in other words,

  • everybody is better off with managed payments (fee-wise) EXCEPT big-stores selling books
  • under managed payments, there’s no final value fee advantage for being a big-store

* Remember you got 0.55% discount over the payment processing portion of the fees too and is not shown here since we’re just talking about savings in vanilla final value fees.

As far as books (12%) is concerned, if you are a big-store owner, your raw commissions cap raised from $250 to $300 because $300 = $2500 * 12%. But if you factor the 0.55% discount, if the sale price is $x,

     $$ (0.12-0.0055) x = 0.1145x > 250 $$ $$ x > 2183.4 $$

Since the raw commissions stops at $300 ($2500 * 12%), the additional $50 cap increase starts to get offset (and turn out positive as the processing fee discounts outweighs the commissions cap increase) when the payment processing discounts ABOVE $2500 covers all of it:

     $$ 0.0055(x-2500) > 50 $$ $$ x>11590.91 $$

So the range of sale price x which the only setup (books for big-store sellers) can do worse is

     $$ 2183.4 < x < 11590.91 $$

There are some ambiguities (technically incorrect documentation) on eBay’s website which implied vanilla final value fees (portion) are charged for sales tax. I made a sale and checked the numbers and it’s not true. Only the 2.35% payment processing fee portion is charged against the sales tax (like paypal for handling extra money), the category final value fee (in my case 9.15%) is not applied to the sales tax.

They actually meant “the 2.35% payment processing fee portion” when they said “managed payment final value fees”. This is also part of the reason why I wrote this article, because they do not use the language that conceptually separate the two portion of the combined final value fees (vanilla final value fee + payment processing fee) in managed payments, thinking that they are simplifying the math for sellers, without realizing if the two concepts really fused into one, they’ll be shortchanging sellers over sales tax.

The $0.3 fixed per-transaction fee applies to both managed payments and the conventional way (Paypal also charge +$0.3 fixed per-transaction), so nothing has changed.

 135 total views,  2 views today

Mathematics of calculating overheads to charge

It’s very common to have a percentage fee (called tax rate below) slapped on our earnings:

  • Commissions (e.g. eBay final value fees)
  • Sales Tax
  • Incremental income taxable within the same bracket.

Many adults cannot directly figure out how much EXTRA do they need to earn to get the target amount of that are rightfully theirs (after fees).

They are missing out these handy intuitions:

  • If your EXTRA earnings are taxed at 40%, not wasting an extra $100 is almost as good as earning $166.67!
  • You always undercharge the fee overhead if you just multiply your target amount with it (intuitive but WRONG). The amount you get shortchanged goes up like a rocket for rates past 10%!

All you need is grade school math to figure it out, but the results are highly non-linear and are not easy to remember. This means the tutorial below makes an excellent discussion material to motivate mathematics education in grade school!

If you want to copy or use the materials, just remember to reference “Rambling Nerd with a Plan” blog page or “Humgar LLC”. You don’t have to ask and you are welcome. I certainly appreciate comments about this tutorial.

Before I start, hints for working with percentages:

  • divide percentages by 100. Think multipliers/factors in your head.
  • a factor of 1 represents the full amount
  • division by x is multiplication by reciprocal 1/x
  • preferably work in terms of shrink/expand factors (multiplications only) over the FULL amount, rather than working out the excesses (additions/subtractions)

Assigning intuitive names are very important for interpreting algebraic expressions with familiar life concepts!

Let’s define these variables first:

  • T is the target price you want to get AFTER the fees
  • D is the damage you should charge
  • r is the rate (fee/tax percentages)
  • E is the excess that goes to the fee/tax collector

These derived variables will be discussed in the body of the tutorial

  • s is the shrinkage (multiplier), where


  • m is the magnifier (multiplier),


  • c is the compensation (multiplier) for billing,


If somebody pays you the total damage D before tax/fees (at rate  r), you are home free with T after subtracting the fees D \times r from D

    \[D - rD = (1-r)D \equiv sD = T\]

In other words, you the FULL damages gets shrunk by a factor s \equiv (1-r) which becomes the target amount T you get to keep for yourself.

Don’t be scared by the algebra! It’s just the other way of saying, if your tax rate is 30%, it means you get to keep 70% of your income, because 100%-30% = 70%, so the shrinkage s is 0.7

Since you have the target price T in mind and want to undo the shrinkage (multiplication) to calculate the full amount you should charge D, you divide the target price by the T by the same factor to magnify it back:

    \[D = \frac{T}{s} = \frac{T}{1-r}\]

It is NEVER helpful to directly multiply the fee/tax percentage with the target price T like what most people would intuitively do. We can think of the division above as multiplying by the reciprocal of the loss factor s or (1-r), which we will call m the magnifier:

    \[m = \frac{1}{s} = \frac{1}{1-r}\]

An alternative view is to break the damage D into target price T along with excess E to bill the customers for the fees/taxes (which goes to the collector):

    \[D = T + E\]

My preferred way to calculate the excess is simply compute D first by finding calculating the magnifier m, or simply dividing the target price T by the shrinkage s

    \[D = mT = \frac{T}{s} = \frac{T}{1-r}\]

then subtract the target price T from the damage D to get the excess:

    \[E \equiv D-T\]

which you can write it in terms of target price T which you know so you don’t have to work out the total damages D first:

    \[E \equiv  D - T = mT - T = T(m-1)\]

We can define compensation (multiplier) c as how much you should multiply the target price T with:

    \[c \equiv m-1\]

to recover your fee/tax costs E:

    \[E = cT\]

e.g. if you need to charge the customer 1.43 times to breakeven after fees (given a 30% tax/fees rate), the overhead ‘item’ on the bill should be 0.43 (43%) of the target price. For a $100 item, you’ll need to bill your customer $43 more just to cover a 30% fees.

In summary, we have

    \[P \equiv T + E = (1+c)T\]

with c that can be figured out quickly as

    \[c = \frac{r}{s}\]

where r and s are both bounded between 0 and 1 which adds up to 1:

    \[r + s = 1\]

Take an example of 30% tax rate (r=0.3), the shrink is 70% (s=0.7), because the factors are complements to each other which adds up to 1.

    \[0.3 + 0.7 = 1\]

If you want to write it all in terms of shrinkage  s:

    \[c = \frac{1}{s}-1 = \frac{1-s}{s}\]

Since 1-s = r, we can rewrite the compensation (factor) in these complement terms (r,s), which I think it’s the easiest way to remember:

    \[c = \frac{r}{s}\]

or simply the rate r divided by shrinkage s,

You can also write it in terms of fees/tax rate r in full:

    \[c = \frac{r}{1-r}\]

e.g. if you have a 30% tax rate , you can find the compensation (factor) c by calculating 3/7, because it’s simply 30% over 70%.

To estimate the overhead charge to offset the fee percentage, or compensation c by multiplying with the target price T:





The gap (amount you get shortchanged by computing compensation c wrong) is:

    \[g \equiv c-r = \frac{r}{1-r}-r = \frac{r^2}{1-r}\]

The numbers look close enough (for the intuitive but wrong way) when it’s like around 10%, but your loss (overheads not charged) shoots up (non-linearly) as the fee/tax percentage goes up beyond 10%!

Fee percentage


Correct overhead % to charge

    \[c = \frac{r}{1-r} = \frac{r}{s}\]



5% 5.26% 0.26%
10% 11.11% 1.1%
20% 25% 5%
30% 42.86% 12.86%
40% 66.67% 26.67%
50% 100% 50%

Intuitively, you need to charge DOUBLE the target price if half of it gets taxed to breakeven, NOT adding half of the target price as the overhead! The FULL target price itself is the right overhead to charge for a 50% tax rate!

Since the numerator r is bounded because 0 \leq r < 1, the denominator (1-r) can blow up (the overhead needed to charge your customer) as it gets small (i.e. high tax/fee percentage). Here’s a plot of



e.g. A 66.6% imports tax rate means giving two cars to the government when you import one!

To push it to the extreme, 90% tax rate would mean 900% overhead, which means if you buy one car, you give the government 9 cars, assuming they don’t tax themselves. Your estimates are off by 10 times if you use the wrong method to compute the excess E making up for the tax that gets charged.

If people can think in terms of the excess you will need to earn EXTRA to offset the tax rate, you will think twice about letting the government dip in another 2% or so. That’s why welfare-state through taxes can be highly counter-productive when it get past certain point.

Advanced analysis for the intrigued

Just for fun, let’s investigate the impractical case (communist tyrants) when tax rates gets to 100% and above (r \geq 1):

Fee percentage


Correct overhead % to charge

    \[c = \frac{r}{1-r} = \frac{r}{s}\]



\vdots \vdot \vdots
90% 900% 810%
100% \infty \infty
200% -200% -400%
300% -150% -450%
\vdots \vdot \vdots
\infty -100%

When charged 100% tax rate, the government seize any gains from your production. There’s never enough overhead you can charge your customer to breakeven.

The more perverted case is what happens when you go above 100%, say at 200% tax rate? When you sell $100 worth of stuff, you pay the government $200 to do so. You are paying a $100 penalty to work/produce $100 for the government. Twisted!

Then how do we explain the negative numbers in the compensation (factor) c? In reality, it means you ALWAYS make a loss no matter what. There’s no way you can bill your customer to make up for the loss.

In the unrealistic (unicorn) case, if the benevolent crazy dictator is willing and able to compensate your losses (at the sales tax rate), aka giving you money back every time you lose money,

    \[P = (1+c)T\]

means the the magnifier m \equiv (1+c) < 0 for sure when r \ge 1. It’s illustrated in the graph as a deadzone

    \[-1 < \frac{r}{1-r} < 0\]


which you can verify the same by solving this inequality

    \[-1 < \frac{r}{1-r} \leq 0\]

and realize you get r-1 \ge r when (1-r) \leq 0, which boils down to saying -1 \ge 0 which is a contradiction.

That means to achieve target earnings T under tax rates above 100%, you should charge the customer negative amounts (i.e. giving away goods + money) in order to get the negative taxes (subsidy).

e.g. At 300% tax rate (r=3), it your sticker price (also target price) is $100, you’ll need to GIVE the customer $50 so the government will triple match your loss as a subsidy (which is $150), which is enough to cover the $50 giveaway (to the customer) plus the $100 so you’ll breakeven.

Having negative tax (subsidy) is a perverse incentive. Forget about maintaining a target earning (same as the original sticker price for the goods you are selling), just lose (give away) money as fast as you can to suck up as much subsidy as you can before the system collapse.

I still fondly recall my economics 301 (intermediate microeconomics professors) James Montgomery saying that “if you can graph it, it can possibly happen” in the lecture.

Even more sophisticated math for the geeks

Remember from above, the magnification factor m can be rewritten as the reciprocal of shrinkage factor s?

    \[m = \frac{1}{s} = \frac{1}{1-r}\]

which reminds me of geometric series

    \[\frac{1}{1-r} = 1 + r + r^2 + r^3 + \cdots}\]

given |r| < 1? For non-perverted cases, we are considering 0 \leq r < 1, which is well within the domain.

This gives an idea of approximating the compensation factor c:

    \[m \equiv 1+c = 1 + r + r^2 + r^3 + \cdots\]

which after taking 1 off both sides:

    \[c = r + r^2 + r^3 + \cdots\]

This explains exactly why people are wrong to just assume c is just r, because their false intuition kept ONLY the first order term in the power series approximation!

The gap (how much they are off with the WRONG way), is

    \[g \equiv c-r = \frac{r^2}{1-r} = r^2 + r^3 + \cdots\]

So while 0.1^2 dies fast enough (0.01) by 2nd order term, 0.9^2=0.81, 0.9^3 = 0.729 … are still very significant up to say 6th order term which makes it off by a factor of 8.1.

Yes, you are off by 1% when the tax rate is 10%, but you can be wrong by a factor of 8.1 times if you just multiplied the tax rate r with the target price T to estimate the amount of excess E to collect to make up for the fees!


  • The total damage (bill) you should charge your customer can be calculated by dividing the target amount (of money you want to home free with) by the shrinkage, which is (1 – tax rate). e.g. 30% tax rate means 70% shrinkage. Divide the target by 0.7 to get the final bill
  • A shortcut to calculate how much you should put in (by multiplying with the target price) for an charge item on the bill to make up for the fees is (tax rate)/(shrinkage) e.g. 30% tax rate means 70% shrinkage. Multiply the target by 30/70 (or 3/7, which is 42%) to get the excess which covers the fee.
  • Do NOT attempt to use the rule of thumb to calculate the excess by just multiplying with the tax rate unless it’s 10% or less. The ‘rule of thumb’ assumed r^2 (and thus the higher powers) are insignificant, which is nowhere true for 0.1 and above based on this graph!

 111 total views

The mess converting decibels to voltages in test instruments (dBm, dBW, W, dbV, V)

Complex conversions between decibels and physical quantity has always been a rich source of confusion. The reason is that dB(something) is actually a loaded word with hidden assumptions:

  • dB always works on base-10
  • dB is always a relative (dimensionless) POWER quantity, the convenience scaling factor is always 10. It does NOT make sense directly on non-power quantities.
  • dB(something) is always with respect to a quantity (the something), and the reference quantity is often not written in full. Since there is an implicit reference, db(something) can be mapped to absolute quantities.

If you are a diverse multi-disciplinary techie like me (math, electronics, programming, computers), it’d frustrate the hell out of you when you talk to people who has been working exclusively on a narrow field for at least a decade and they have a table of commonly used numbers in their memorized: they act like you are supposed to know how to get the numbers in the dB-variant that they use, than explaining to you what the field-specific assumptions are (likely because they forgot about it).

I hope this post will clear up the confusion by working out an example in test instrumentation, most commonly in RF as well, converting dBm to Volts.

Before I start, I’ll clarify the most common form of beginner confusion in EE and physics: converting between dB and voltages:

\mathrm{dB}= 20\log_{10}(V)

This looks like a definition of decibel, except the scaling factor is 20 magically for Volts. It is correct (under very commonly used assumptions) as well. Most people take it as an equivalent definition of decibels, and throw away these important assumptions behind it:

  • the reference is 1V,
  • and the resistance* (common to the voltage of interest and the reference voltage) gets cancelled

and run into troubles when they venture into those dB-variants like dBm. Technically the above should be written as dBV, but I have seen very few people use the clearer term.

The decibel formula for voltage came from

\mathrm{dBV} = 10\log_{10}(\frac{P}{P_{ref}})

where P = \frac{V^2}{R} and P_{ref} = \frac{1^2}{R}, you get

\mathrm{dBV} = 10\log_{10}(\frac{V^2/R}{1^2/R})

The R get cancelled out and you get

\mathrm{dBV} = 10\log_{10}(V^2)

People moved the squaring out and lumped (multiplied) it with the scaling factor 10:

\mathrm{dBV} = 20\log_{10}(V)

So the whole reason why it is 20 instead of 10 is simply because P\propto V^2, and \log(V^2) \equiv 2\log(V).

Now back to the business converting dBm to dBV or Volts.

First of all dBm is dB(mW), NOT dB(mV). The RF/telecom people are just too lazy to write out the most important part: the physical quantity expressly, because nearly all the time, it’s the power that matters to them.

However, I often need to connect a RF generator to a high bandwidth oscilloscope, so the very self-centered RF/telecom nomenclature start to become problematic when people of different fields need to talk to each other. Oscilloscope see everything in volts. RF sees everything in power, often in dB.

Then we get to the (mW) part, which means the reference quantity in the definition is 1mW, which is a physical quantity with dimensions. Then how are we going to convert it to Volts? You cannot jump to the shortcut formula I illustrated above with the 20 factor this time because the reference is in mW and your quantity is in Volts.

You’ll need to convert power to voltages. To do so, you’ll need to know voltages induced by power ‘dissipated’ through a ‘resistance’ across a component (load). The missing gap is that you will need to know the load ‘resistance’ before the conversion. With that, you can use P = V^2/R, or rewritten as V^2 = PR when it’s more convenient.

All RF-related test-instruments and bench function generators typically have a 50Ω output impedance, which means it also assumes a matching 50Ω as mathematically, it provides the maximum power transfer (sadly split evenly between the load and wasted at the instrument’s output impedance). For convenience, the amplitude you see in the instrument control panel refers to the amplitude you see at a 50Ω load, not what the instrument pumps out internally (that’s why you see 2Vpp when your function generator says 1Vpp if you hook it up to a low-end oscilloscope that serves 1MΩ by default).

Since we are dealing with continuous wave (not transient power), all amplitude quantities on RF test instruments are in RMS (power or voltage) unless otherwise specified. So the quantities we have for dBm is

\mathrm{dBm} = 10\log_{10}(\frac{P_{rms}}{1mW})

when written in terms of voltages,

\mathrm{dBm} = 10\log_{10}(\frac{V^{2}_{rms}/50Ω}{1mW})

Instead of splitting it into 3 terms and immediately grouping the constants, I’d like to first convert dBm to dBW:

\mathrm{dBW} = 10\log_{10}(P/1W)

\mathrm{dBm} = 10\log_{10}(P/0.001W)

The linear quantity in dBm is artificially scaled 1000 times bigger than in dbW, to put it in a comfortable scale for us to work with smaller signals. Therefore dBm is always 30dB higher than dbW (the smaller the reference, the bigger the relative numbers look).

So back to the above in dBW, we subtract 30dB to get to dBW:

\mathrm{dBm} = \mathrm{dBW} + 30\mathrm{dB}


\mathrm{dBW} = 10\log_{10}(V^{2}_{rms}/50Ω)

We can separate the load and put it on the left hand side

\mathrm{dBW} + 10\log_{10}(50Ω) = 10\log_{10}(V^{2}_{rms})

The right hand side is dBV, and you can think of the load as scaling the power up (inducing) the voltage-squared quantity (V^2 = PR, or \log(V^2) = \log(P) + \log(R)).

10\log_{10}(50Ω) is 16.9897dB, for most purposes I’ll just say the load lift the dBW by 17dB when turning it into dbV.

Having both together,

\mathrm{dBW} + 17\mathrm{dB} = \mathrm{dBV}
\mathrm{dBW} = \mathrm{dBm} - 30\mathrm{dB}

\mathrm{dBm} - 30\mathrm{dB} + 17\mathrm{dB} = \mathrm{dBV}
(This is how you should remember it, so you can replace the +17dB for 50Ω with
10\log_{10}(R) when you work on other applications, like 600Ω, 4Ω, 8Ω for audio.)


-30dB to undo the mili- prefix (small reference value bloated the numbers)
+17dB to account for the load inducing the voltage by burning Watts

The end result (for the 50Ω case):

\mathrm{dBV} = \mathrm{dBm} - 13\mathrm{dB}

Then you can convert dBV to V_{rms}:

\mathrm{dBV} = 10\log_{10}(V^2_{rms}/1^2) = 20\log_{10}(V_{rms})

V_{rms} = 10^{\frac{\mathrm{dBV}}{20}}

V_{rms} = 10^{\frac{\mathrm{dBm}-13dB}{20}}

Phew! That’s a lot of steps to get to something this simple. So the moral of the story is that these assumptions cannot be ignored:

  • The quantity is always power in dB, not voltages
  • dB(mW) has a reference of 1mW. The smaller the reference, the bigger the numbers
  • RMS voltages and power are used in RF
  • 50Ω is the load required to convert from power to voltages

Keysight already has a derivation, but it’s just a bunch of equations. The missing gap I want to fill in this blog post is that people find this so confusing they’d rather believe a formula or a table pulled on the internet:  it doesn’t have to be this way after realizing that there’s a bunch of overlooked assumptions.

* Technically I should call it (load) impedance Z, as in RF, capacitive and inductive elements are nearly always involved, but I want to make it appealing to those with high school physics background.

 1,024 total views,  2 views today

Synthesized/Arbitrary Waveform/Function Generators: sampling rate matters

It’s basic (signal processing) mathematics that square waves (or any waveform with sharp edges) carry harmonics that doesn’t die fast enough, therefore not band-limited. The more sudden the transition is, the more harmonics you need to preserve to faithfully represent a signal in practice.

Unless the signal itself is known to be band-limited (like sine waves, classical modulation schemes, SRRC), it puts the burden on the test instruments involved to provide large bandwidths and the matching high sampling rate (needs to do better than Nyquist).

The technology today provides generous bandwidths and sampling rates for oscilloscopes at reasonable prices, but synthesized function/waveform generators with the same bandwidth/sampling rate can easily cost 10 times if not even more. For the money to buy a used not-too-old 500Mhz pulse generator, you can buy a 4GHz 20GS/s oscilloscope!

For oscilloscopes, users are often aware that the rounded square waves/transitions they see on the screen is due to bandwidth limitations, and will account for the reality distortion in their mind. If your square wave clocks are pushing the sampling rate of the scope and the combined bandwidth between the scope and the probes, you should very well expect that you cannot catch much glitches and pretty much use the oscilloscope as a frequency counter or check for modulations.

For synthesized signal generators, bandwidth and samplers are way more precious. Oscilloscopes generally has 8-bit vertical resolution (256 steps), but synthesizers typically has 12-bit vertical resolution (4096 steps) or better. There are imperfect techniques trading vertical resolution and sampling rate, but there is no free lunch. 

I have on my bench these 12-bit function generators:

  • an old Analogic 2045B (roughly US$1300, 400Mhz, 800MS/s, 2Mpts) and
  • a much more modern Agilent/HP 33120A (roughly US$600, 15Mhz, 40MS/s, 16Kpts)

that I’d like to illustrate the value of getting a higher bandwidth (and therefore higher sampling rate) unit. The 33120A has a much finer control over frequency/amplitude/offset steps (2045B only allows fixed point increments) and might have better noise characteristics and much smaller form factor considering Analogic 2045B is made in the 1970s and HP 33120A is made at least 20 years after that. I would have liked to keep only my 33120A or 33255B on my bench to save space, but once you’ve seen this screenshot, you’ll know why I’m still willing to cough up the space for 2045B:

The upper waveform (Channel 1, yellow) is a from Analogic 2045B while the lower waveform (Channel 2, green) is from HP 33120A. They are both set at around 15Mhz and you can see that when approaching the limit of the synthesizer, 33120A rounds off the square wave to almost a sinusoid.  Square waves gets ugly quickly above 10Mhz and this is as far as 33120A is capable of.

On the other hand, the square waves are bang-on for 2045B, and is still decent at around 50Mhz (my BNC cable starts to come in question). That’s why it’s still worth getting a high bandwidth synthesized function generator even if your budget only allows for clumsy old models if you use your function generator for something more than sinusoids.

Note that function generators are typically designed to pump out to 50Ω loads and the amplitude displayed in the function generator (V_{gen}) assumed so. That’s why beginners gets confused why they read 2V_{pp} when the function generators says 1V_{pp}: the function generator sends out nearly double the voltage so the potential divider formed between the 50Ω output impedance of the function generator and the 50Ω load impedance will split the voltage into half. If you set your oscilloscope to 1MΩ load, you are getting (2V_{gen})\frac{1MΩ}{1MΩ+50Ω}, which is nearly 2V_{gen}.

More importantly, if the load is not matched, the small capacitances in the chain will distort the waveform received by your oscilloscope severely at higher frequencies, so you can barely get a square wave at fundamental frequency above 2Mhz undistorted if you feed it into an oscilloscope with 1MΩ input impedance, while in reality the signal generator, cables, and oscilloscope can do much better.

Most cheap low bandwidth oscilloscopes (like 100Mhz) do not have 50Ω option. Nonetheless the impedance needs to be matched if you work with square waves at 2Mhz or above. Just buy a 50Ω feed-through BNC ‘termination’ adapter and plug it right at the 1MΩ input port. In reality, it’s a divider between 50Ω and (1MΩ//50Ω), with the scope seeing \frac{(1M//50)}{(1M//50)+50} of 2V_{gen}. For all practical purposes the oscilloscope sees (2V_{gen})\times0.5 or V_{gen}.

With 50Ω feed-through BNC ‘termination’ adapters, make sure you work out the impedance matching if you split the signals if it’s not the simple nearly 1:1 potential divider halving the voltage. At low frequencies, the amplitudes will be off, but when you start going into Mhz range and above, your signal will be distorted badly as well.


 857 total views,  2 views today


 857 total views,  2 views today

Super-simplified: What is a topology

‘Super-simplified’ is my series of brief notes that summarizes what I have learned so I can pick it up at no time. That means summarizing an hour of lecture into a few takeaway points.

These lectures complemented my gap in understanding open sets in undergrad real analysis, which I understood it under the narrow world-view of the real line.

X: Universal set

Topology ≡ open + \left\{\varnothing, X\right\}

Open ≡ preserved under unions, and finite intersections.

Why finite needed for intersections only? Infinite intersections can squeeze open edge points to limit points, e.g. \bigcap^{\infty}_{n}(-\frac{1}{n},\frac{1}{n}) = \left\{0\right\}.

Never forget that \left\{\varnothing, X\right\} is always there because it might not have properties that the meat open set B doesn’t have. e.g. a discrete topology of \mathbb{Q} on (0,1) = B \subseteq universal set X=\mathbb{R} means for any irrational point, \mathbb{R} is the only open-neighborhood (despite it looks far away) because they cannot be ‘synthesized*’ from \mathbb{Q} using operation that preserves openness.

* ‘synthesized’ in here means constructed from union and/or finite intersections.

[Bonus] What I learned from real line topology in real analysis 101:

  1. Normal intuitive cases
  2. Null and universal set are clopen
  3. Look into rationals (countably infinite) and irrationals (uncountable)
  4. Blame Cantor (sets)!



 900 total views

Quote of the day: You can’t learn too much linear algebra

Benedict Gross, Professor of Mathematics at Harvard said in his E-222 lecture: ‘You can’t learn too much linear algebra’.

If you read my WordPress pages in Signals and Systems, I’m trying a new approach to explain the materials done under the classical approach in a much more compact way using basic ideas in linear algebra.

Linear algebra is fun and easy to learn (at intro levels), once you get used to the fact that it’s a carefully picked set of restrictions that most physical problems boils down to. In high school algebra, it’s disguised as ‘method of detached coefficients’ when you solve systems of simultaneous equations.

Once you model your problem into linear equations (the hardest part), you will see the equivalence (or mathematically equivalent analogs) of different problems ranging from economics to circuits and mechanics. The beauty of the ‘detached coefficients’ approach separates the context of the problem from its mathematical structure as the application specific variables are often grouped as a vector (or matrix) that you deal with as a unit. In fact, most problem boils down to this:

    \[ \bf{Ax = b} \]

It’s your job to construct \bf{A}, \bf{x} and \bf{b} and tell people what they mean.

I agree with Gilbert Strang, Professor of Mathematics at MIT that it’s time to make linear algebra the standard curriculum over calculus. Digital control used to be a very advanced graduate class, but after a few decades, it’s undergraduate material. Linear algebra has very few knowledge dependencies (hard pre-requisites), so it’s great material to teach at any level.

 4,414 total views,  1 views today