Plot2d-Question: How to plot 2 changing functions economically



Thank you very much, that looks great! Thanks!
But I'm afraid i was not precious:
I want to stay in eq1 for x seconds, than switch over to eq2, stay there 
y seconds, and then switch over to eq1 and stay there x seconds, and so 
on. I think you understand what I mean.
How can I get this? (I think this might be a little bite more 
complicated...)
Can you please help me!
Michael

On 01/16/2011 11:29 PM, Richard Hennessy wrote:
> Try this, it is not very efficient but it is what you asked for.
>
> eq1: 'diff(I,t)=(U-R*I)/L;
> eq2: 'diff(I,t)=-(R*I+U)/L;
>
> F(_t, _t0,_R,_L,_U,_eq1,_eq2):=block
> (
>    [_e1,_e2,_e3,_e4],
>    _e1:ode2(_eq1,I,t),
>    _e2:ic1(_e1, t=0, I=0),
>    _e3:ode2(_eq2,I,t),
>    _e4:ic1(_e3, t=_t0, I=rhs(_e2)),
>    at(if  t < _t0 then rhs(_e2) else rhs(_e4),[t=_t,R=_R,L=_L,U=_U])
> )$
>
> plot2d([F(t,4,2,6,3,eq1,eq2)],[t,0,14]);
>
>
> -----Original Message----- From: Michael Heidinger
> Sent: Sunday, January 16, 2011 12:29 PM
> To: maxima at math.utexas.edu
> Subject: Plot2d-Question: How to plot 2 changing functions
> economically
>
> Hello,
> first of all, i'm new to this mailing list - Please excuse my language,
> as it's not my first.
>
> Well, I want to simulate an electrical circuit, which has two operation
> condition, each of them is discribed with a diffential equation. After a
> certain time i want to switch to the other equation.
> 1. Equation: 'diff(I,t)=(U-R*I)/L (eg. 1 second in this operating
> mode=t_equation1)
> 2. Equation: 'diff(I,t)=-(R*I+U)/L (eg. 2 second in this operation
> mode=t_equation2)
> Well, I solved them with ode2 and ic1 for some certain points. Eg: t=0
> and I=0. But I want to plot I for a longer periode to see how I
> develops. I would wish myself a function where I can plot a continous
> flow of current.
> The function I would wish should look like
> I(U,R,L,t,t_equation1,t_equation2).
>
> Dear experts, how can I construct such a function? Thank you in advance
> for your help!
> Michael Heidinger
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>