# Numerical solution to a circuit

Discussion in 'General Electronics Chat' started by ahaister, Aug 27, 2009.

1. ### ahaister Thread Starter New Member

Aug 27, 2009
6
0
Dear members of the forum,

I have the following circuit:

The voltage source is actually a signal that gets filtered by the circuit and gets distorted.

I'm trying to reverse the filteration caused by this circuit to get the original signal.

I don't know how to do this, but I thought I could use a differential equation describing this circuit and find some reciprocal function.

My questions are:

1) what is the differential equation describing the voltage on C2 (the left capacitor)?

2) is there another way to do this? maybe some de-convolution?

Any help would be appreciated,

Thankfuly,

2. ### The Electrician AAC Fanatic!

Oct 9, 2007
2,464
375
Do you know how to write the transfer function for your circuit using the complex variable s (transfer function in the s-domain, in other words)?

If you do, then show your result.

3. ### ahaister Thread Starter New Member

Aug 27, 2009
6
0
Dear electrician,

I don't know how to write my transfer function in the s-domain.

I have measured a signal on capacitor 2, and I wish to know the original voltage, i.e. reverse the effect of the circuit.

How do you write the transfer function in the s-domain and how would it solve this?

Thankfuly,

EDIT: Is there maybe a reciprocal circuit where I can input the measured signal on capacitor 2 and get the original signal? I use the PSPICE simulator.

EDIT2: I would like to find some function that does: Vsource = function(Vc2) according to this circuit.

Last edited: Aug 27, 2009
4. ### The Electrician AAC Fanatic!

Oct 9, 2007
2,464
375
I'm wondering if this is really a homework problem.

You shouldn't be asked a question like this unless you have had instruction in methods to find a transfer function, I would think.

What kind of course are you taking? What have you studied so far?

5. ### ahaister Thread Starter New Member

Aug 27, 2009
6
0
This is not a homework problem.

I'm a graduate student, measuring signals from cells using electrodes. I measured a signal using an electrode that goes through the filter described in this circuit. I'm trying to reverse that filter because the signal is distorted.

Since my knowledge in circuits is more or less zero, I thought I'd ask for help here.

Sincerely,

6. ### The Electrician AAC Fanatic!

Oct 9, 2007
2,464
375
OK. I understand. Next time don't post your request in the homework help forum. When you do that, people think you're trying to get help for a homework problem; post in the General Electronics Chat forum. :-(

Maybe a moderator will see this and move the thread, but in the meantime I'll see if I can help you.

Since you are measuring signals from cells that means that the signals are relatively low speed and low frequency, and you can use opamps to process them.

What you need is a filter with the inverse transfer function.

How did you derive this circuit you've posted? Is it a standard response known in the measurement of cell signals, perhaps published in a standard textbook?

The circuit as you have published it has no output other than a current in the wire to the right of C2. Shouldn't there be a load resistance somewhere, perhaps following C2?

edit: It occurs to me that maybe you intended for the output to be taken at the junction between C1 and C2. Is that the case?

Last edited: Aug 27, 2009
7. ### ahaister Thread Starter New Member

Aug 27, 2009
6
0
I apologize for posting at the wrong forum.

Electrician,

1. You are right, the signals I'm measuring are action potentials, which means the frequencies are no more than 1 KHz.

2. Yes, I need a filter with the inverse transfer function.

3. I derived this circuit because it is standard, an electrode (gold electrode in this case) has a capacitance and resistance depending on its dimensions. So I calculated R1 and C1 according to the dimensions of my electrode. C2 is the input capacitance of my amplifier, 8pF, according to the manufacturer.

4. Exactly, the output of my circuit is at the junction between C1 and C2. That's what the amplifier measures, the voltage on C2.

Thankfuly,

8. ### The Electrician AAC Fanatic!

Oct 9, 2007
2,464
375
Ok, here's what you should do.

Get yourself a suitable opamp; it would probably be best to get one that is unity gain stable. You may have enough experience to know what you need, and you may have suitable ones around your lab. Or, I'm sure you can get a recommendation for a suitable opamp from your colleagues.

The transfer function for your circuit is:

$\frac{sR1C1+1}{sR(C1+C2)+1}$

All you do is wire up an opamp with the same network in the feedback, and you get the inverse transfer function.

The transfer function of the circuit shown in the attached image is (for infinite opamp gain):

$\frac{sR(C1+C2)+1}{sR1C1+1}$

You'll notice that the R's and C's occur together in products. This means you can scale the component values and still have the same time constants.

I'd recommend increasing the value of C1 and C2 by 10000 and decreasing the value of R1 by 10000.

If the output of your amplifier is not DC coupled, you may have to add the resistor R2. Even if it is DC coupled, having R2 won't hurt anything.

Actually, you should make R2 equal in value to R1,. This will minimize DC offsets from bias current drops in the resistors, provided the output of your amplifier isn't DC coupled. If it is, you may get a small DC offset at the output of the opamp. If this is a problem, get a high-performance opamp with small input offset voltages and bias currents.

• ###### CellProbeInverse.png
File size:
4 KB
Views:
24
Last edited: Aug 28, 2009
9. ### ahaister Thread Starter New Member

Aug 27, 2009
6
0
Dear Electrician,

It's working like magic. I used PSPICE to reconstruct my pre-recorded signals. It requires a little tweaking, but as you can see from the picture the calibration pulse's amplitude at the beginning of the trace (60-80 msec) is nearly what it should be (5mV) and the shape is almost rectangular:

I appreciate your help very much, I would like to understand a little bit what you did:

Is it common knowledge that inserting the filter circuit in the feedback to the opamp reverses the transfer function? Which chapter in the allaboutcircuits.com online book contains information about finding transfer functions of circuits?

Why did you choose R2 to be 100k?

Thanks a lot.

Last edited: Aug 28, 2009
10. ### hgmjr Moderator

Jan 28, 2005
9,030
216
I have moved this thread to the "General Electronics Chat" sub-forum since the OP has clearly indicated that it is not homework.

hgmjr

11. ### steinar96 Active Member

Apr 18, 2009
239
4
ahaister, trying to explain how they are derived (the theory behind it) would propably take pages of material. So i recommend you buy yourself a book on circuit analysis. You need knowledge of calculus and complex numbers to understand the transfer functions.

But in short S is a complex number describing frequency.

Deriving the transfer function as mentioned is a whole course of circuit analysis. Circuits involving capacitive and inductive elements are described by differential equations in time. Solving these equations is extremely complex in the time domain (at least for third degree or higher order derivatives) so they are mathematicly transformed (laplace transformation) into the so called s domain or frequency domain which enables us to use "fairly" simple algebra to work out solutions of the circuit.

If you want to derive them yourself you need to buy yourself a good book on this material.

12. ### The Electrician AAC Fanatic!

Oct 9, 2007
2,464
375
Steinar96's comments are relevant. Since you already asked about solving differential equations, and because you are a graduate student in the sciences, I'm sure you must have taken some diffeq classes.

The s variable stands for 2*pi*i*f, where i = sqrt(-1) and f=frequency; it's a convention used with Laplace transform analysis which is universally used to solve networks containing reactive elements such as capacitors and inductors as well as resistors. The Laplace transform method is just a shortcut method for solving the differential equations describing the network steady state behavior.

I arrived at the transfer function for your network by letting the impedance of a capacitor be 1/sC and the impedance of a resistor be R. Then just using the rules for the impedance of a parallel combination and the voltage divider rule, the network can be solved as easily as if you were solving a network consisting only of resistors. That's the beauty of the Laplace transform method.

I just have to ask. Are you actually going to build hardware, or will you just use simulation to process your pre-recorded signal?
Perhaps you could audit a network analysis course in the EE department at your school.

I decided on using an opamp because prior knowledge about feedback networks told me that placing a network in the feedback loop would provide an inverse transfer function.

Opamps must have a path for DC current somewhere for each input. If the output from your amplifier had a capacitor in series with it, and you connected that to the + input of the opamp without R2, then there would be no path for the DC bias current (which every opamp must have) from the + input.

I can't imagine that your amplifier would have no DC path to ground at its output, but the 100K won't be a significant load on the amplifier output so it won't hurt anything with its presence.

It will prevent the opamp output from saturating if your opamp circuit isn't connected to the amplifier output, so I would include it.

Finally, when you build this circuit, don't use values of 8pF, 3.5pF and 3 gigohms for the components; these values are much too high impedance to use in this circuit. It would be difficult to obtain accurate value components and the stray wiring capacitances will affect the accuracy of your transfer function. Also, 3 gigohms in the feedback path is so high that the offset voltage generated by the opamp bias current might cause a significant DC offset in the output.

You should change their values in the simulation to 80 nF, 35 nF and 300kΩ to verify that the performance of the circuit is unchanged.

I just have to ask. Are you actually going to build hardware, or will you just use simulation to process your pre-recorded signals?

Last edited: Aug 28, 2009
13. ### ahaister Thread Starter New Member

Aug 27, 2009
6
0
Electrician,

I would like to make this inverse as the experiment is taking place. The problem with building hardware is that I have a multi-electrode array (64 electrodes) and their impendance varies greatly within the same array of electrodes. If we are to build some hardware to tackle this problem as the experiment is taking place, then it would have to be 60 or 120 knobs adjusting the capacity compensation (1-2 for each electrode).

However, what I did immediately after you showed me the inverse circuit, is run my pre-recorded data through the circuit in PSPICE, that's good for now, as an offline method to deconvolute my data.

Maybe there is some way to do it online, but by software. This is why I asked for the differential equations, I thought I could solve this as a transient analysis circuit, and run something in matlab on it as the experiment it taking place. PSPICE is relatively slow.

If you have any recommendations for a book on network analysis, describing laplace transformation and transient analysis I'd appreciate it.

As for my amplifier, its input resistance is 10^13, so yes, 100k will not have a great load on it.

I will run the values you suggested when I get home.

Thankfuly,

14. ### The Electrician AAC Fanatic!

Oct 9, 2007
2,464
375
It's the output impedance (resistance) of your amplifier that determines whether the 100k will have any effect, not the input resistance.

I think almost any book with a title like "Analysis of Electric Circuits", or "Elementary Network Analysis" would do.

Why don't you go by your college bookstore and see what the texts for the relevant EE courses are? I'm sure they would be appropriate.

I think what you need to do is derive a circuit for each of your different electrodes and then derive an impulse response for each. You could then use Matlab to convolve each data stream with the relevant impulse response.

I'll see about trying that out later.

I'm going to PM (private mail) you my email address. If you'll send me the csv file you used to generate the picture in the earlier post, I can use it to test the impulse response.