# Thread: Integration of piece-wise constant function

1. ## Integration of piece-wise constant function

Hallo all,
I am from electronics background. I have a simple mathematical problem which seems daunting for me.

The general equations for calculating charge is given below. It integrates the capacitance C(v) over the range of voltage 'v'
q(v) = ∫ C(v)dv. limits are from 0 to v (Charge eqn)
Now to obtain the current from this charge the following equation holds true
and i(t) = dq(v(t))/dt . (current eqn).

Now I have a charge which is constant over different range of the voltage. So I dont know how to integrate over the voltage to find the total charge which when differentiated will give me the current.

The following is the value of the capacitance C_GS, C_GD that are dependent on voltages v_GS and v_GD.

C_sov, C_dov and C_ch are constants.
if (v_GS > vth) //cut-off region
begin
C_GS = C_sov + 0;
C_GD = C_dov + 0;
end
else if ((v_DS) > v_GS-vth) // saturation region
begin
C_GS = C_ch/2+C_sov;
C_GD = C_ch/2+C_dov;
end
else // linear region
begin
C_GS = (2/3)*C_ch+C_sov;
C_GD = C_ch/3+C_dov;
end

Now I need to find the charge
q_g = ∫ C_GS(v_GS)dv in the range o to v_GS
q_d = ∫ C_DS(v_DS)dv in the range o to v_DS

With these values, I can differntiate to get the respective currents. The problem is with calculating the charges q_d and q_g.
Could somone help me in deriving the equations for q_d, q_g for the above case? Thanking you in advance.

2. ## Re: Integration of piece-wise constant function

It's hard to follow what you're saying; especially when you state the problem as a computer if-else statement! To get charge we need to know how capacitance depends on voltage. Your last integrals are confusing. You have not indicated how capacitance depends on v.

3. ## Re: Integration of piece-wise constant function

Hello Ojones,
I regret for my confusing statements. The capacitance is piece wise constant over different range of voltage for e.g
C_GS(v_GS,v_DS) = C_sov for v_GS > vth;
C_ch/2+C_sov for (v_DS) > v_GS-vth && v_GS<vth;
(2/3)*C_ch+C_sov for (v_DS) <= v_GS-vth && v_GS<vth;

Now to find the charge q_g, I need to integrate C_GS(v_GS,v_DS) w.r.t V_GS and v_DS in the interval [0,Vg];[0,Vd].
Similarly for C_DS to get q_d.

4. ## Re: Integration of piece-wise constant function

OK, I see what you mean. Integrating piece-wise defined functions is easy; just split the integral up into the intervals on which the pieces are defined. If the functions are constant it's even easier; the integral will be just the sum of the each capacitance times the width of the interval on which it's defined.

Your notation is very confusing. For example, you write

q_g = ∫ C_GS(v_GS)dv in the range o to v_GS.

The expression C_GS(v_GS) indicates that C_GS is a function of v_GS but you seem to be saying that it's piece-wise constant. Bad notation. I also can't follow very well your piece-wise definition of C_GS.

5. ## Re: Integration of piece-wise constant function

Thank you Ojones.