Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Graphing Transfer Function

Status
Not open for further replies.

EN0

Member
Hey Everyone,

I ordered a HP-50G calculator recently, which should arrive sometime soon, for school this year. I would like to graph several transfer curves of various filters. For instance, I would like to graph the transfer function of the following of a typical RC low-pass filter (see attachment):

  • C = 10µF
  • R = 10kΩ
  • Vin = 5V

The equations below apply:
[LATEX]V_O = V_I_N \frac{X_C}{Z}[/LATEX]

Where:

• [LATEX]X_C = \frac{1}{j \omega C}[/LATEX]
• [LATEX]Z = \sqrt{R^2 + X_C^2}[/LATEX]

Therefore:

[LATEX]V_O = \frac{\frac{1}{j \omega C}}{\sqrt{R^2 + (\frac{1}{j \omega C})^2[/LATEX]

Graphing with a complex number kind of throws me off, would someone show me how to graph the equation with the values above?

I'd appreciate any help!

Thanks,

Austin
 

Attachments

  • RCLowPassFilter1.PNG
    RCLowPassFilter1.PNG
    2.5 KB · Views: 467
Last edited:
Hey Everyone,

I ordered a HP-50G calculator recently, which should arrive sometime soon, for school this year. I would like to graph several transfer curves of various filters. For instance, I would like to graph the transfer function of the following of a typical RC low-pass filter (see attachment):

  • C = 10µF
  • R = 10kΩ
  • Vin = 5V

The equations below apply:
[LATEX]V_O = V_I_N \frac{X_C}{Z}[/LATEX]

Where:

• [LATEX]X_C = \frac{1}{j \omega C}[/LATEX]
• [LATEX]Z = \sqrt{R^2 + X_C^2}[/LATEX]

Therefore:

[LATEX]V_O = \frac{\frac{1}{j \omega C}}{\sqrt{R^2 + (\frac{1}{j \omega C})^2[/LATEX]

Graphing with a complex number kind of throws me off, would someone show me how to graph the equation with the values above?

I'd appreciate any help!

Thanks,

Austin

Just some corrections:

[LATEX]V_O = V_I_N \frac{Z_C}{Z_T}[/LATEX]

[LATEX]Z_C = \frac{1}{j \omega C}[/LATEX]

[LATEX]Z_T = R + Z_C[/LATEX]

Therefore:

[LATEX]V_O = \frac{\frac{1}{j \omega C}}{R + (\frac{1}{j \omega C})[/LATEX]

You have various ways to plot that.
I'd just use the magnitude: [LATEX]|V_O|[/LATEX]

Where magnitude = [LATEX]sqrt(V_O . V_O^{*})[/LATEX]
 
Last edited:
Hi,


When you have a complex number you have to compute the magnitude and the phase angle. Once you compute these two you then plot both of them and that tells you about the transfer function.

The part with the 'j' is the imaginary part, and the other part is the real part, and the amplitude is:
Ampl=sqrt(real^2+imag^2)

and the phase angle is:
Angle=taninv(imag/real)

you just have to make sure your angle is in the right quadrant.

You then plot the Ampl and Angle.

For the RC low pass filter you have:
Z=R+1/jwC
and the output Vo is:
Vo=Vi*jwC/(R+jwC)
You could do this two ways, one way is to multiply the top and bottom by the conjugate of the bottom;
Vo=Vi*jwC*(R-jwC)/((R+jwC)*(R-jwC))

and then simplify the bottom and top separately, which gives us:
Vo=(Vi*wC^2+j*Vi*R*wC)/(wC^2+R^2)

and now the imaginary part is the part with the 'j':
imag=Vi*R*wC/(wC^2+R^2)

and the real part is the part without the 'j':
Vi*wC^2/(wC^2+R^2)

and now we can calculate the Ampl and Angle.

So in other words, when you have a transfer function with an imaginary part (the j) you have to separate the real from the imaginary part and then calculate the Amplitude and the Phase Angle, and plot either the Amplitude or the Phase Angle or both. The Amplitude is usually of more concern, but the Phase Angle is also of interest in many applications.
The Amplitude is what you would measure with a volt meter (for the low pass filter).

This seems a little strange at first, but it quickly becomes easier once you do a few of these problems.
 
Last edited:
and now the imaginary part is the part with the 'j':
imag=Vi*R*wC/(wC^2+R^2)

and the real part is the part without the 'j':
Vi*wC^2/(wC^2+R^2)

I understood all the equations up till this point, which I'm not entirely sure what your doing with the numerator?

Also, I believe that the angular frequency ω² = ω, since that seems to be the case in your equations.

Just need you to elucidate on separating the imaginary and real parts of this equation:

[LATEX]V_O = \frac{V_I \omega C^2 + j V_I R \omega C}{\omega C^2 + R^2[/LATEX]

I appreciate your help!
 
Hi there,

First off, yes, wC^2 was shorthand for really (w*C)^2 which of course is w^2*C^2.
Sorry about the confusion.

With a general Vo say:
Vo=a+b+c+j*(d+e+f)

the imaginary part is the part that is multiplied by 'j', so the imag part is:
d+e+f

and the real part is everything else left:
a+b+c

It's as simple as grouping all the terms that get multiplied by j and those that do not.

If you have a denominator that is real such as:
Vo=((a+b+c)+j*(d+e+f))/D

then you first rewrite by breaking up the numerator and dividing both parts by D:
Vo=(a+b+c)/D+j*(d+e+f)/D

and now the real part is:
(a+b+c)/D

and the imag part is:
(d+e+f)/D

Note that the 'j' is left out when we separate this way.

For another example, say we have:
Vo=(2+3j+4+5j)/9

We first group the numerator into real and imag parts:
Vo=((2+4)+j*(3+5))/9

and then split:
Vo=(2+4)/9+j*(3+5)/9

and so the real is:
(2+4)/9

and the imag is:
(3+5)/9

Of course we could have simplified this one before we got this far.

If the denominator is NOT real, then one way to solve it is to multiply the numerator and denominator by the conjugate of the denominator, then simplify the denominator, then simplify the numerator, then proceed as above (because the denominator will now be real).

So for:
Vo=(Rn+j*In)/(Rd+j*Id)

we could do this:
Vo(numerator)=(Rn+j*In)
Vo(denominator)=(Rd+j*Id)
conjugate of denominator=Rd-j*Id
denominator times conjugate=(Rd+j*Id)*(Rd-j*Id)=Rd^2+Id^2
numerator times conjugate=(Rn+j*In)*(Rd-j*Id)=Rd*Rn-j*Id*Rn+j*In*Rd+Id*In

so the resulting Vo is:
Vo=(Rd*Rn-j*Id*Rn+j*In*Rd+Id*In)/(Rd^2+Id^2)

and then we proceed as above to separate the real and imag parts.
 
Last edited:
Here it is using FREE LTSpice. It took less than 1 minute to build the schematic and simulate it...
 

Attachments

  • DF61.png
    DF61.png
    36.3 KB · Views: 455
Hi again,


Yes, using a simulator sure does help sometimes. What else helps when we substitute the actual component values early on in the calculations.
For the example of C=10uf and R=10k we can proceed like this:

Vo=Vin*(1/(j*w*C))/(R+1/(j*w*C))

Simplifying:
Vo=Vin/(1+j*w*R*C)

Substitute actual values for R and C:
Vo=Vin/(1+j*w*10000*0.000010)

Simplify:
Vo=Vin/(1+j*w*0.1)

Multiply top and bottom by conjugate of bottom:
Vo=Vin*(1-j*w*0.1)/((1+j*w*0.1)*(1-j*w*0.1))

Simplify:
Vo=Vin*(1-j*w*0.1)/(1+w^2*(0.1)^2)

Simplify:
Vo=Vin*(1-j*w*0.1)/(1+w^2*0.01)

Distribute Vin and split numerator into real and imag parts:
Vo=(Vin*1-Vin*j*w*0.1)/(1+w^2*0.01)

Separate real and imag parts:
Vo=Vin/(1+w^2*0.01)-Vin*j*w*0.1/(1+w^2*0.01)

Separate real and imag parts and leave out the 'j':
realpart=Vin/(1+w^2*0.01)
imagpart=-Vin*w*0.1/(1+w^2*0.01)

Calculate the amplitude:
Amplitude=sqrt(realpart^2+imagpart^2)=Vin*10/sqrt(w^2+100)

So now we have a formula for the amplitude:
Vo(Ampl)=Vin*10/sqrt(w^2+100)
 
Hey,

Sorry for not getting back soon enough, I was unable to access ETO. I now understand the equations and was able to graph the transfer function on my calculator.

Thanks for the help!
 
Hi MrAl,

After further review, I'd like to make several clarifications on the final answer you conveived. I understand the following equations, but I am unsure how you get the '10' and '100' in the final answer?

[LATEX]V_O = \frac{V_I_N(1 - \omega *0.1)}{(1 + \omega^2 * 0.01}[/LATEX]

[latex]Real = \frac{V_I_N}{(1 + \omega^2 * 0.01)}[/latex]

[latex]Imaginary = -\frac{V_I_N \omega * 0.1}{(1 + \omega^2 * 0.01)}[/latex]

[latex]Amplitude = \sqrt{Real^2 + Imaginary^2}[/latex]

[latex]Amplitude = \sqrt{(\frac{V_I_N}{(1 + \omega^2 * 0.01)})^2 - (\frac{V_I_N * \omega * 0.1}{(1 + \omega^2 * 0.01)})^2[/latex]

Does all of that look correct? If it is, could you simplify the last equation, please? I would like to see how you received the '10' and '100' in your final answer.

Thanks!
 
Last edited:
Hi again,

First of all, although the imag part is negative when you square it it becomes positive. Thus for denominator D=1+w^2*0.01 we would have:

Ampl=sqrt((Vin/D)^2+(-Vin*w*0.1/D)^2)=sqrt((Vin/D)^2+(Vin*w*0.1/D)^2)

We can simplify the two terms inside the square root first though by multiplying top and bottom of each by 100 first, and we would get:

100*v/(w^2+100)
and
(10*v*w)/(w^2+100)

and then after squaring them we get:
10000*v^2/(w^2+100)^2
and
(100*v^2*w^2)/(w^2+100)^2

and now adding them we get:
10000*v^2/(w^2+100)^2+100*v^2*w^2/(w^2+100)^2

and so adding numerators we get:
(10000*v^2+100*v^2*w^2)/(w^2+100)^2

which simplifies to:
100*v^2*(w^2+100)/(w^2+100)^2

which simplifies more to:
100*v^2/(w^2+100)

and since this is the quantity inside the square root we have to take the square root, and we get:

10*v/sqrt(w^2+100)

which is the Amplitude.

You dont have to do it that way though. You can work with fractions and simplify later if you like.

Either way this is probably the best way to do it, but your calculate may have a function that finds the imag part and another function that finds the real part, so for the transfer function H(s) you could do this for example:
rp=realpart(H(s))
ip=imagpart(H(s))
Ampl=sqrt(rp^2+ip^2)

but it's good to know how to do it manually too.
Note the above assumed the functions were called "realpart" and "imagpart" but they could be something else.
Also, the functions realpart and imagpart may only work on real numbers and not symbolic expressions, in which case you have to replace all the R's and C's in H(s) with their real values and also you have to step w by some quantity say starting at 0.1 Hz and stepping by 1 Hz, which will give you a lot of values for Ampl which you can then graph. This is similar to creating a function Ampl as above after replacing all the R's and C's with their true values, and graphing Ampl vs w.

If you can get back here again i'd like to hear how you made out with all this and the graphing too.
 
Last edited:
Hi MrAl,

Thanks for all your help, I truly appreciate it. I just graphed the transfer function, and it looks perfect.

One more question though; how can I calculate the attenuation in dB that the passive filter will exhibit?

Thanks,

Austin
 
Hi there,

Normally you calculate the filter signal voltage attenuation in db, so you would first calculate Vout and then calculate db:
db=20*log(Vout/Vin)

where the log function above is the log base 10, or if you use the natural log then log(x)=ln(x)/ln(10)=ln(x)/2.302585093 approximately.

Some other facts of interest are:
The cutoff point of the filter is said to be at -3db, but more accurately -3.0103db. That's the point where the voltage reaches 1/sqrt(2) of the input.
The frequency where this occurs for a single stage low pass RC filter is:
F=1/(2*pi*R*C)
 
Last edited:
Hi,

Yes, but all passive filters have attenuation. At my work, we measure the attenuation they exhibit in dB. I was curious about how I could calculate that.

The resonant frequency, or cutoff frequency, of this particular circuit is 1.5915 Hz? Doesn't that seem very low?

Thanks,

Austin
 
Last edited:
Hi again,

Yes, the attenuation in db is 20*log(Vout/Vin) as i was saying.
Also, yes, 1.59Hz is the 3db cutoff point. You can use that to check your calculations at 1.59Hz.
If that is too low then you need to decrease C or R or both, depending on what impedance would suite your circuit better.
 
Hi,

The problem is that the insertion loss will vary over frequency; to get a reasonably accurate value, should I take the mean of all the values?

Also, how did you find that the cutoff frequency is more accurately -3.0103dB?

Thanks,

Austin
 
Hi again Eno,


Yes that is absolutely correct, the loss varies with frequency, not like a digital filter which might have a sharper cutoff.

There's no average value of all the values really, i dont think there is a reason for doing that. Normally you plot a graph of all the values (say with a step of 1Hz) and then you look at the graph and see if it looks like that filter will work for your application. A low pass filter is 'said' to pass low frequencies and attenuate high frequencies, but that's just a shorthand for what one really does. It really passes lower frequencies but then begins to cut the signal at some point and at what is called the 'cutoff' point the attenuation becomes equal to -3db and then after that it is said to 'roll off' to lower and lower values as the frequency increases. I can post a graph of your filter if you would like to see this, but didnt someone already post that...i think so. Take a look at MikeMI's post #6 in this thread. It shows the cut in db (top graph) as frequency increases. You can also see that near approximately 1.59Hz the response is roughly -3db.

The cutoff frequency is a theoretical frequency which occurs at an attenuation equal to 1/sqrt(2), which in db is close to -3.0103db, and that's the voltage value where a perfectly isolated load would receive exactly half power. That's a common reference point used to compare filters. This probably originated during the days of early radio when power was more important, but these days the half voltage point (-6db) might be of interest too.
The -6db frequency for the low pass filter is:
F=sqrt(3)/(2*pi*R*C)
which for your values of 10k and 10uf comes out to F=2.76Hz appoximately.
 
Last edited:
That was the mathematics for a first-order RC low pass filter, what about a second order one? :)
 
That was the mathematics for a first-order RC low pass filter, what about a second order one? :)

Who needs math....
 

Attachments

  • F2.png
    F2.png
    31.9 KB · Views: 460
  • F1.png
    F1.png
    21.1 KB · Views: 413
That was the mathematics for a first-order RC low pass filter, what about a second order one? :)


Hi again,


For the second order low pass RC filter with different R and C values where R1 and C1 make up the first stage and R2 and C2 make up the second stage, we have:
Vout=Vin/(s^2*C1*C2*R1*R2+s*(C2*R2+C2*R1+C1*R1)+1)

but if both R and C values are the same it simplifies to:
Vout=Vin/(s^2*C1^2*R1^2+s*3*C1*R1+1)

From either of these we can find the -3db point by solving for F when the amplitude of Vout=1/sqrt(2).

There is one more form though that is interesting, and that's for when we have isolation or near isolation between stages. The simplification comes about because we end up with two stages convoluted together and so all we have to do is multiply their individual responses to get the total response. This works when there is at least one isolation amplifier used between stages or the impedance of the second stage is much higher than the first so there is insignificant loading of the first stage output.
If the response of the first stage is say 1/x and the response of the second stage is say 1/y, then the total response is simply 1/x times 1/y which of course is equal to 1/(x*y). If there is a little bit of loading of the first stage output then this wont be exact, but still a fairly decent approximation. This kind of filter can be made by impedance scaling the first stage to produce the values for the second stage so that the second stage does not load the first stage output too much.
 
Last edited:
Hey,

There are a couple things I’d like to address before we get into second-order filters that I just thought of.

• What parameters will increase the bandwidth of my first-order RC LPF?
• What is the effect of increasing resistance while lowering capacitance? For instance, if I originally had 1k and 10nF but changed it to 10k and 1nF? In the equations, I still get the same RC time constant so it seems to have no effect, yet I believe it must do something?
• Likewise, what is the effect of increasing capacitance while lowering resistance?
• What is the effect of increasing voltage?

After these questions are addressed, I’d like to do the mathematics for a high-pass filter. After that, perhaps we can continue with the second-order filters.

Edit: After thinking it over some more, I now am fairly sure that changing the resistor value compared to the capacitance value (or vice verse), although still keeping the same time constant, will affect the impedance, correct?
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top