Issue with formula impedance magnitude  - Page 1
Forum section: electronics / projects

author: b_force
author_rank: Super Contributor
timestamp: June 01, 2022, 04:57:30 pm
content: So I have the following circuit for a problem I need to solve.Fyi, this is not a school problem, in fact it has been like 15 years ago that I actively calculated such thingsSo I am pretty rusty to be very honest, lol.Anyway, I think I got pretty far, but there seems to be a mistake somewhere, since the formula in the end doesn't line up with the simulation.I just can't find it. Or is it as simple as moving R1 in front of the whole part?edit; changed formula, had a small typo

author: TimFox
author_rank: Super Contributor
timestamp: June 01, 2022, 05:06:04 pm
content: In the first equation, it should be +jwCin the denominator.XC= -j/wC, so 1/X= +jwC.

author: b_force
author_rank: Super Contributor
timestamp: June 01, 2022, 05:11:41 pm
content: Quote from: TimFox on June 01, 2022, 05:06:04 pmThanks, yes I think you're correct, however I am not even near the value I need with that.Seems I have something flipped or so, but I just can't find itedit; actually no, with one over X the negative sign doesn't flip.I am very sure about that part, I double checked it with just a simple parallel RLC circuit.

author: TimFox
author_rank: Super Contributor
timestamp: June 01, 2022, 08:05:51 pm
content: IfX= -j/wC= -(-1)/(jwC) = +1/(jwC), multiplying numerator and denominator byj,then 1/X= +jwCQEDBy the way, were you computing the magnitude of a complex value?If the complex valueY=A+jB, then its magnitude /Y/2=YxY* =A2+B2,where * denotes the complex conjugateY* =A-jB.

author: b_force
author_rank: Super Contributor
timestamp: June 01, 2022, 08:48:43 pm
content: Quote from: TimFox on June 01, 2022, 08:05:51 pmWell for the parallel RLC part, I double checked with some other resources.like;https://www.translatorscafe.com/unit-converter/en-US/calculator/parallel-rlc-impedance/https://en.wikipedia.org/wiki/RLC_circuithttps://www.electronics-lab.com/article/parallel-rlc-circuit-analysis/Unfortunately the results I am getting still don't line up for some reason.I doubled checked with simulation, the parallel RLC circuit works fine, but as soon as I add the series resistor, I get strange results.

author: Benta
author_rank: Super Contributor
timestamp: June 01, 2022, 09:07:36 pm
content: Don't use jw when doing this kind of of thing, it makes things confusing. Use the Laplace operator s instead. At the end you can substitute jw for s.I get:Z = R1+ [(sLR2) / s2CLR2+ sL + R2)]Classic second-order response.Final result:Z = R1+ [(jwLR2) / (R2+ jwL - CLR2)]

author: b_force
author_rank: Super Contributor
timestamp: June 01, 2022, 09:13:51 pm
content: Quote from: Benta on June 01, 2022, 09:07:36 pmOh right, yes, things start to come backAnd now it's just a matter of |Z|=R1²+X² to get the magnitude of the impedance?(X is that whole bunch bit tricky to write down)Not quite sure how that is gonna workout, since there is that little pesky R2down there?isn't there a jw missing next to the C btw?

author: TimFox
author_rank: Super Contributor
timestamp: June 01, 2022, 09:21:37 pm
content: As a quick error check, setwfor parallel-resonance:wL= 1/wC.At that frequency, the reactances cancel out and the final (real) impedance isR1+R2, and the admittance is the reciprocal thereof.

author: b_force
author_rank: Super Contributor
timestamp: June 01, 2022, 09:29:10 pm
content: Quote from: TimFox on June 01, 2022, 09:21:37 pmYes, that is correct, so the first formula should be right, I don't have any doubts about it.I just need the magnitude of it

author: Benta
author_rank: Super Contributor
timestamp: June 01, 2022, 09:32:23 pm
content: Dunno what you mean by "amplitude of the impedance". If you mean the total impedance seen by your source, it's already described by the equation I showed.When playing with this kind of thing, I mostly make a spreadsheet where I enter the equation, make columns with frequency (or whatever) and plot the results to a graph.I'm certain there are better tools for this, but it works for my simple mind, and I always know exactly what I'm doing/seeing.

author: b_force
author_rank: Super Contributor
timestamp: June 01, 2022, 09:37:05 pm
content: Quote from: Benta on June 01, 2022, 09:32:23 pmYour formula still has the "j" in it. Sorry, I meant magnitude, not amplitude (typo)I need it in the part of of the magnitude of Z as well as the phaseSee links before.|Z|=sqrt (real²+imaginary²)Yes I am actually working with a spreadsheet right now

author: TimFox
author_rank: Super Contributor
timestamp: June 01, 2022, 09:38:36 pm
content: Themagnitudeof the (complex) impedanceZ=R1+ jXis given by |Z|2=R1²+X²Note the extra squared on the magnitude.

author: Benta
author_rank: Super Contributor
timestamp: June 01, 2022, 09:39:22 pm
content: Quote from: b_force on June 01, 2022, 09:29:10 pmWhich "first formula"? If you're referring to your OP, it's certainly not correct.

author: b_force
author_rank: Super Contributor
timestamp: June 01, 2022, 09:39:55 pm
content: Quote from: TimFox on June 01, 2022, 09:38:36 pmI am familiar with that, this can also be seen in the first picture with the formulas.But that's were the struggle is.

author: b_force
author_rank: Super Contributor
timestamp: June 01, 2022, 09:40:35 pm
content: Quote from: Benta on June 01, 2022, 09:39:22 pm|Z|=sqrt (R²+X²)And I was asking what the part is that is not correct.Where do we leave R2 for example, does that belong to the X part, or the R part?

author: Benta
author_rank: Super Contributor
timestamp: June 01, 2022, 09:42:22 pm
content: Quote from: TimFox on June 01, 2022, 09:38:36 pmThat's basically correct, but not really helpful here. The second part of the network is not jX, but somewhat more complex.

author: Benta
author_rank: Super Contributor
timestamp: June 01, 2022, 11:06:56 pm
content: OK, let's take it further. You'll need to bring it all together in a common impedance function. This is what i showed you earlier:Z = R1+ [(sLR2) / s2CLR2+ sL + R2)]Integrating R1you'll get The following nastiness:Z = [(R1 (s2CLR2+ sL + R2) + sLR2)] / [s2CLR2+ sL + R2)]Fortunately, this can be rearranged/simplified to:Z = [s2CLR1R2+ sL(R1+R2) + R1R2] / [s2CLR2+ sL + R2]Again a typical second-order resonant LC circuit.Getting the numerical impedance is done using Pythagoras:Z = sqrt[(R1R2- w2CLR1R2)2+ w(L(R1+R2)2] / sqrt[(R2-w2CLR2)2+ wL)2]Beware: this does not take phase shift into account, it's pure magnitude.

author: b_force
author_rank: Super Contributor
timestamp: June 01, 2022, 11:31:11 pm
content: Quote from: Benta on June 01, 2022, 11:06:56 pmwhere did the w or 2*pi*f go in that last section?I need it as function of a frequency, otherwise it's not a magnitude.Or did you just skipped it for simplicity reasons?Btw, I am aware that it's a typical second-order resonant LC circuit.

author: Benta
author_rank: Super Contributor
timestamp: June 01, 2022, 11:42:58 pm
content: Quote from: b_force on June 01, 2022, 11:31:11 pmOw, ow, ow. You're absolutely right. it's pretty late at night here, but that should NOT happen. I'm extremely embarassed.I'll correct the post immediately.EDIT: corrected now.

author: b_force
author_rank: Super Contributor
timestamp: June 02, 2022, 12:02:56 am
content: Quote from: Benta on June 01, 2022, 11:42:58 pmThanksI think there is something going wrong with the brackets as well unfortunately.I just put it all in a spreadsheet, but at this point it's just a graph that's going up in frequencyedit: this is what I think you wrote down, is that correct?

author: Benta
author_rank: Super Contributor
timestamp: June 02, 2022, 10:17:16 am
content: Revisiting my corrected post (#16), my brackets are correct.Yours are wrong.

author: b_force
author_rank: Super Contributor
timestamp: June 02, 2022, 12:21:49 pm
content: Quote from: Benta on June 02, 2022, 10:17:16 amThanks again.Unfortunately there are still some brackets missing.So I have to guess.w(L(R1+R2)2This part is missing a closing bracketThis part as wellsqrt[(R2-w2CLR2)2+ wL)2

author: Benta
author_rank: Super Contributor
timestamp: June 02, 2022, 05:00:15 pm
content: Damn! My proofreading sucks.This should be it:Z = sqrt[(R1R2 - w2CLR1R2)2+ (wL(R1+R2))2] / sqrt[(R2 - w2CLR2)2+ (wL)2]The general format for finding complex magnitude (=length of vector) is sqrt[Re2+ Im2] (Pythagoras)I think I'll use LibreOffice Math in the future and post as graphics/PDF instead. The whole "sub", "sup" circus makes editing a post into a nightmare.Cheers.

author: b_force
author_rank: Super Contributor
timestamp: June 02, 2022, 07:38:20 pm
content: Quote from: Benta on June 02, 2022, 05:00:15 pmNo worries!Can get very convoluted very quickly with those kind of formulas.Btwhttps://codecogs.com/latex/eqneditor.phpTechnically there is a phpBB plugin for it as well.edit: Unfortunately this formula does not seem to give the right response(and i quadruple checked if I didn't make any mistake)

author: Benta
author_rank: Super Contributor
timestamp: June 02, 2022, 09:21:00 pm
content: Redone it in LibreOffice math, hope all the brackets are clear now:

author: b_force
author_rank: Super Contributor
timestamp: June 02, 2022, 09:36:26 pm
content: Quote from: Benta on June 02, 2022, 09:21:00 pmThank you so much for your effortUnfortunately I just don't get the right result when dividing |D| / |N|For an example,R1 = 3.6R2 = 23.108L1 = 54.1mHC1 = 772.77uFAttached is the impedance magnitude, how it suppose to look like.Unfortunately it's not even near this thing.

author: b_force
author_rank: Super Contributor
timestamp: June 02, 2022, 09:41:58 pm
content: Here is the graph used with the formula from above (in blue)

author: Benta
author_rank: Super Contributor
timestamp: June 02, 2022, 10:55:04 pm
content: It is unclear to me exactlywhatyou are simulating and how. Could you please reveal the test point in your simulation? The X- an Y-axis you've presented have no legend.If you're really looking for the impedance, current through R1 might be a pointer.

author: Benta
author_rank: Super Contributor
timestamp: June 02, 2022, 11:03:53 pm
content: Quote from: b_force on June 02, 2022, 09:41:58 pmThat's impossible. Setting w to 0, you'll get a DC response of 3.6 ohms, exactly like your simulation. Where on earth would 300 ohms come from?

author: b_force
author_rank: Super Contributor
timestamp: June 02, 2022, 11:31:52 pm
content: Quote from: Benta on June 02, 2022, 10:55:04 pmThat's given in the startpost, so the impedance seen by V1

author: Benta
author_rank: Super Contributor
timestamp: June 02, 2022, 11:49:19 pm
content: Quote from: b_force on June 02, 2022, 11:31:52 pmYes, that's clear. But in a simulation you need a probe point. V1 is an ideal voltage source, so how are you probing?

author: b_force
author_rank: Super Contributor
timestamp: June 03, 2022, 12:01:52 am
content: Quote from: Benta on June 02, 2022, 11:49:19 pmV(V1) / I(V1) = impedance seen by voltage source V1.Put I also have another source, so I know that the impedance curve (red) is 100% correct.I think something goes wrong with the brackets in libre office, I tried to manually calculate it with the calculator (SpeedCrunch) and it looks a lot better. But in libre office I get this.....

author: b_force
author_rank: Super Contributor
timestamp: June 03, 2022, 12:13:57 am
content: Finally!yeah, some things went a little strange in LibreOffice.Is the phase part also as difficult?

author: TimFox
author_rank: Super Contributor
timestamp: June 03, 2022, 01:35:12 am
content: You need to take an arctangent. Use the function of two variables in your mathware, rather than taking the ratio of Im and Re parts and then taking the arctangent, to avoid ambiguity in the arctangent function.

author: b_force
author_rank: Super Contributor
timestamp: June 03, 2022, 01:23:57 pm
content: btw, on the formula on the previous page, the denominator and nominator seem to be flipped.

author: Benta
author_rank: Super Contributor
timestamp: June 03, 2022, 05:20:55 pm
content: Quote from: b_force on June 03, 2022, 01:23:57 pmYes, they are. That's a problem with my English skills, though, not the maths/equation. I used the wrong terms and symbols. Sorry.Note to self: it's called "Numerator" and "Denominator".EDIT: The post in question (#24) has been corrected.

author: Benta
author_rank: Super Contributor
timestamp: June 03, 2022, 05:25:11 pm
content: For extracting phase, arctan or atan is needed. This is tricky, though, as that function is problematic at +/- PI/2, because the controlling variable will move towards infinity, and it will also give ambiguous results.If you're using a spreadsheet, a nice trick is to use the atan2 function, which avoids this issue.The very first post (sticky) on the "Projects" page here tells you how.The equation is: (phase of numerator) minus (phase of denominator)And yes, I got the terms right this time

author: antenna
author_rank: Frequent Contributor
timestamp: June 03, 2022, 10:06:26 pm
content: Ok, time for a fool proof approach....Step 1: Combine the parallel reactances into a single value just like you would with parallel resistors, 1/Xtotal = 1/X1 + 1/X2, making sure to use negative values for capacitive reactances.Step 2: Convert R2 and Xtotal to their series equivalents, Rs = (Rp * Xp^2) / (Rp^2 + Xp^2) and Xs = (Rp^2 * Xp) / (Rp^2 + Xp^2).Step 3: Add R1 to Rs, Rtotal = R1 + RsNow you have a simplified network consisting of only one resistance and one reactance in series, Rtotal ± j Xs.Step 4: To get the magnitude, take the square root of the sum of their squares. Magnitude |Z| = sqrt(Rtotal^2 + Xs^2).....and if you want the phase, then just take the inverse tangent of X / R.If you get the wrong answer doing it that way, your computer is broken.

author: Benta
author_rank: Super Contributor
timestamp: June 03, 2022, 10:26:55 pm
content: Did you miss post #31 and #32?Please post a plot of your "fool proof" approach using your "non broken" computer. Should be easy with a spreadsheet.

author: antenna
author_rank: Frequent Contributor
timestamp: June 03, 2022, 11:11:20 pm
content: Quote from: Benta on June 03, 2022, 10:26:55 pmSo, you want me to graph the magnitude and phase of a specific set of components over a wide frequency span in a spreadsheet? If I am understanding that correctly, ok, Ill give it a go.

author: Benta
author_rank: Super Contributor
timestamp: June 03, 2022, 11:13:28 pm
content: Cool.I look forward to the results. Magnitude is enough. We can look at phase later.

author: antenna
author_rank: Frequent Contributor
timestamp: June 03, 2022, 11:53:40 pm
content: Ok, here it is. All I have is openoffice, so I hope *.ods is ok. Attached is the ods spreadsheet and ill also attach a screenshot of it. I'll let someone else mess with the chart axis etc, I left that on automatic. Insert the component values, initial frequency in hz, and step size in Hz (i think I went just beyond 1000 data points in the chart.Edit: and yes, at first, I had missed the success shared in post #32. Thanks for pointing that out to me

author: b_force
author_rank: Super Contributor
timestamp: June 04, 2022, 12:34:58 am
content: Quote from: Benta on June 03, 2022, 05:20:55 pmHaha, no worries, mistakes are there to learn from!It happens all the time with me as wellI do only think that the first R1 doesn't have to be squared.Doing some backwards math computingBut I also managed to get some other results from someone else as well, he came up with the following;

author: b_force
author_rank: Super Contributor
timestamp: June 04, 2022, 01:18:34 am
content: btw, here my spreadsheet from LibreOffice.First tab is formula from here, second tab is the other one (which I am still working on to get it right).The reason why I did it in so many fields, is to make sure LibreOffice is not doing fancy weird things with brackets (which sometimes can really ruin your day)Oh btw, C is 10^-6R1 = ReR2 = Rm