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))
With
alpha=20; beta=4.9139; H0=-0.0116; A=959; P01=100; P02=100; R=0.5; C=0.1;
T1 = 0:0.001:0.639;
H=(exp(alpha*T1)/(alpha^2)+(beta^2)).*(alpha*sin(beta*T1)-beta*cos(beta*T1));
G=(A*H0/C)-P01;
P1=((A*H)/(C-G)).*exp(-T1/R*C);
T2 = 0.639:0.001:1.278;
P2=P02*exp(-T2/(R*C));
i.e. defining time vectors T1 and T2 going with steps of 0.001s, I get the following graph (note that I multiplied P2 by 10^8, because the y-scales rather different.
figure,plot(T1,P1,'r',T2,P2*1e8,'g')
精彩评论