Hello again,
Oh ok, i think you meant this:
v1(t)=1-e^(-t)
v2(t)=(1-e^(-(t-a)))*(t>a)
v(t)=v1(t)-v2(t)
where a is the delay, and note that the factor (t>a) is a logical expression that evaluates to zero for t<=a and evaluates to 1 for t>a. That's just to make the math work for the unit step function u(t-a). The other part missing in your expression (but present previously) is the exponent t-a in v2(t).
Given the above expression for v(t), that's not periodic, but it does work for the first cycle of the square wave. With a period of 1 and 50 percent duty cycle then we have a=0.5
a=0.5
v1(t)=1-e^(-t)
v2(t)=(1-e^(-(t-a)))*(t>a)
v(t)=v1(t)-v2(t)
and now when we evaluate v(1) for example we get the right result, which is v=0.23865 to five significant figures. This agrees with other ways of calculating this.
But again that is not periodic. If we want it to be periodic, we have to do (for example) the following...
Define another interval:
v3(t)=(1-e^(-(t-2*a)))*(t>2*a)
and note all we did here was multiply 'a' by 2, and that brings us to 1.5 seconds because 2*a=1 and so this v3(t) starts to take effect after t=1 up to t=1.5 seconds. So using that next, we get:
a=0.5
v1(t)=1-e^(-t)
v2(t)=(1-e^(-(t-a)))*(t>a)
v3(t)=(1-e^(-(t-2*a)))*(t>2*a)
v(t)=v1(t)-v2(t)+v3(t)
and now we evaluate v(1.5) and we get:
v=0.53822 to five significant digits.
If we want the solution at t=2, we have to do that again. We get:
v4(t)=(1-e^(-(t-3*a)))*(t>3*a)
and note all we did here was multiply 'a' by 3 this time which brings us to 3*a+a or 2 seconds. So we now have in total:
a=0.5
v1(t)=1-e^(-t)
v2(t)=(1-e^(-(t-a)))*(t>a)
v3(t)=(1-e^(-(t-2*a)))*(t>2*a)
v4(t)=(1-e^(-(t-3*a)))*(t>3*a)
v(t)=v1(t)-v2(t)+v3(t)-v4(t)
and now we can evaluate v(2) and we get:
v(2)=0.32645
and that agrees with other methods too.
So you see to get the periodic nature in the result we have to apply that technique repeatedly. For each 'a' interval we have to use the next integer multiple of 'a' in the equation, and depending on if we are charging or discharging we either make the sign positive or negative.
If we do this enough times (roughly until more than 5 time constants) we start to see a repeat in the waveform which means we've reached the periodic portion of the wave. We can then look for the min and max to calculate the ripple.
An alternate method relies on calculating the initial value for each interval, then using the same equation over and over with the previous final value becoming the new initial value.
Here are the results of doing it the way explained above up to t=50 seconds. We can see that after 5 time constants we start to see repetition, and after ten times that (50 time constants) we see very close to the same result for every pulse. We can subtract the min from the max to get the ripple in this case, but note we cant always do that because the peaks dont always occur (for other circuits) at the transition period of the input wave (at the rise and fall times). We are lucky to have this here because it's only a first order equation.
Note also that if we take the average of the two last transition peaks, we get the average DC value. Again we are lucky we can do this here because it's only a first order equation. If it was second order we might have to hunt for the min and max a bit more carefully.
Another thing we can do is form this procedure into an equation as a series, and find the simplification of this series and it will result in a closed form equation for the N^th interval. It's not always easy to do though so it's up to you if you want to try this or not. It may be easy for this circuit but not for the second order circuit.
Oh ok, i think you meant this:
v1(t)=1-e^(-t)
v2(t)=(1-e^(-(t-a)))*(t>a)
v(t)=v1(t)-v2(t)
where a is the delay, and note that the factor (t>a) is a logical expression that evaluates to zero for t<=a and evaluates to 1 for t>a. That's just to make the math work for the unit step function u(t-a). The other part missing in your expression (but present previously) is the exponent t-a in v2(t).
Given the above expression for v(t), that's not periodic, but it does work for the first cycle of the square wave. With a period of 1 and 50 percent duty cycle then we have a=0.5
a=0.5
v1(t)=1-e^(-t)
v2(t)=(1-e^(-(t-a)))*(t>a)
v(t)=v1(t)-v2(t)
and now when we evaluate v(1) for example we get the right result, which is v=0.23865 to five significant figures. This agrees with other ways of calculating this.
But again that is not periodic. If we want it to be periodic, we have to do (for example) the following...
Define another interval:
v3(t)=(1-e^(-(t-2*a)))*(t>2*a)
and note all we did here was multiply 'a' by 2, and that brings us to 1.5 seconds because 2*a=1 and so this v3(t) starts to take effect after t=1 up to t=1.5 seconds. So using that next, we get:
a=0.5
v1(t)=1-e^(-t)
v2(t)=(1-e^(-(t-a)))*(t>a)
v3(t)=(1-e^(-(t-2*a)))*(t>2*a)
v(t)=v1(t)-v2(t)+v3(t)
and now we evaluate v(1.5) and we get:
v=0.53822 to five significant digits.
If we want the solution at t=2, we have to do that again. We get:
v4(t)=(1-e^(-(t-3*a)))*(t>3*a)
and note all we did here was multiply 'a' by 3 this time which brings us to 3*a+a or 2 seconds. So we now have in total:
a=0.5
v1(t)=1-e^(-t)
v2(t)=(1-e^(-(t-a)))*(t>a)
v3(t)=(1-e^(-(t-2*a)))*(t>2*a)
v4(t)=(1-e^(-(t-3*a)))*(t>3*a)
v(t)=v1(t)-v2(t)+v3(t)-v4(t)
and now we can evaluate v(2) and we get:
v(2)=0.32645
and that agrees with other methods too.
So you see to get the periodic nature in the result we have to apply that technique repeatedly. For each 'a' interval we have to use the next integer multiple of 'a' in the equation, and depending on if we are charging or discharging we either make the sign positive or negative.
If we do this enough times (roughly until more than 5 time constants) we start to see a repeat in the waveform which means we've reached the periodic portion of the wave. We can then look for the min and max to calculate the ripple.
An alternate method relies on calculating the initial value for each interval, then using the same equation over and over with the previous final value becoming the new initial value.
Here are the results of doing it the way explained above up to t=50 seconds. We can see that after 5 time constants we start to see repetition, and after ten times that (50 time constants) we see very close to the same result for every pulse. We can subtract the min from the max to get the ripple in this case, but note we cant always do that because the peaks dont always occur (for other circuits) at the transition period of the input wave (at the rise and fall times). We are lucky to have this here because it's only a first order equation.
Note also that if we take the average of the two last transition peaks, we get the average DC value. Again we are lucky we can do this here because it's only a first order equation. If it was second order we might have to hunt for the min and max a bit more carefully.
Another thing we can do is form this procedure into an equation as a series, and find the simplification of this series and it will result in a closed form equation for the N^th interval. It's not always easy to do though so it's up to you if you want to try this or not. It may be easy for this circuit but not for the second order circuit.
Code:
t V(t)
----- --------
0.5 0.393469
1.0 0.238651
1.5 0.538219
2.0 0.326446
2.5 0.591469
3.0 0.358744
3.5 0.611059
4.0 0.370626
4.5 0.618265
5.0 0.374997
5.5 0.620916
6.0 0.376605
6.5 0.621892
7.0 0.377196
7.5 0.622251
8.0 0.377414
8.5 0.622383
9.0 0.377494
9.5 0.622431
10.0 0.377524
10.5 0.622449
11.0 0.377534
11.5 0.622456
12.0 0.377538
12.5 0.622458
13.0 0.377540
13.5 0.622459
14.0 0.377540
14.5 0.622459
15.0 0.377541
15.5 0.622459
16.0 0.377541
16.5 0.622459
17.0 0.377541
17.5 0.622459
18.0 0.377541
18.5 0.622459
19.0 0.377541
19.5 0.622459
20.0 0.377541
20.5 0.622459
21.0 0.377541
21.5 0.622459
22.0 0.377541
22.5 0.622459
23.0 0.377541
23.5 0.622459
24.0 0.377541
24.5 0.622459
25.0 0.377541
25.5 0.622459
Last edited: