About plotting two independent Y-axis on the one plot



Hi,

On 04/30/2013 02:59 PM, Berns Buenaobra wrote:
> Hello all:
> 
> One of the classic problem in RC charge and discharge circuit in the usual
> freshman physics course is being able to plot the voltage rise with a current
> discharge on a single plot so that their intersection in time is determined.
> 
> Now how does one do it with a wxplot2d() with two independent Y-axis on one
> and the same plot? 
> 
> Well this looks easy for a simple case of just one plot:
> R:10e3 $ C:10e-6 $ %tau:R*C; V[max]:10 $
> v(t)=V[max]*(1-(exp(-t/(R*C))));
> wxplot2d(v(t),[t,0,0.5]);
> 
> and
> i(t):=(V[max]/R)*(exp(-t/(R*C)));
> wxplot2d(i(t),[t,0,0.5]);
> 
> but I got into trouble with the temptation with just writing out:
> wxplot2d([v(t),i(t)],[t,0,0.5]);
> 
> which only shows the voltage rise. Easily done in MS Excel but I need the
> symbols for purposes of instruction.
> 
> Any tip?
> 

Well, it looks like v(0)=0 and v(t)->10 as t->infinity, while i(0)=1/1000 and
i(t)->0 as t->infinity.  My guess is that the plot of i(t) is there, but it is
too small to see when v(t) is plotted along with it.

I don't know about wxplot2d, but with plot2d you should be able to do

plot2d([v(t),i(t)],[t,0,0.5],[y,0,0.001]);

and see that the plot of i(t) is there.  If that's the case, I guess you can
switch to units of milliamps (or whatever is appropriate) when plotting.

> Regards,
> Berns B.
> Dept. of Physics - University of San Carlos
> 
> 

Cheers,
Kris Katterjohn