PDA

View Full Version : Plotting Two time dependant graphs at once!


kian651
Feb17-11, 05:56 PM
Basically, we have two functions. P1 and P2.

P1 Kicks in at t=0 and runs for a few seconds (a trig function). Then P2 starts, it's and exponential decay.

Below is what I'm trying to do.

I've tried to create time matrix and even ode solver. I need a way of plotting both functions on a sigle graph,.

Any help is highly appreciated.

alpha=20 beta=4.9139 H0=-0.0116 A=959; P01=100; P02=100; R=0.5; C=0.1;

From T01-T1 (0.639s) H=(exp(alpha*T1)/(alpha^2)+(beta^2)).*(alpha*sin(beta*T1)-belta*cos(beta*T1));

G=(A*H0/C)-P01;

P1=((A*H)/(C-G))*exp(-T1/R*C);

Then: t02-t2 (1.278s) P2=P02*exp(-T2/(R*C))


I've tried and tried but don't know how it works,

Bill Simpson
Feb17-11, 10:53 PM
See if you might be able to apply this idea: Suppose you create a function that = 1 from T01 to T1 and = 0 elsewhere. Multiply your H times that function. Plot that to check it correctly does the first part of what you need. Suppose you create a second function that = 1 from T02 to T2 and = 0 elsewhere. Multiply your P2 times that function. Plot again to check. Now what do you get if you add the first product and the second? Plot and check.

Perhaps this web page might help
http://www.mathworks.com/matlabcentral/newsreader/view_thread/299504