ClearAll;
$DefaultFont = {"Times-Roman",10};
Needs["Graphics`Graphics`"];
tfoc1 = 0.08; tr1 = 0.22; tfoc2 = 0.42; tr2 = 0.56;
correctionfactor = 0.955;
circpars = {0.0075,1.6};
c = 9/(1250 GoldenRatio);
cc = 180/Pi;
horizontalticks = Join[{{0.2,0.2},{0.5,0.5},{0.8,0.8}},
	Table[{0.05i," "},{i,17}]];
q1[t_]:= 350(3 - 10 t)(20 t - 1)(7 - 20 t)/9;
q2[t_]:= -1632000(1 - 30 t/23)(t - 2/5)(3/4 - t)/49;
q3[t_]:= -1120000(1 - 12 t/11)(t - 3/4)(9/10 - t)/6;
V1[t_]:= 5 (8779 + 70560 t - 924000 t^2 + 3136000 t^3 - 3360000 t^4)/432;
V2[t_]:= 2(810447 - 5630400 t + 14463600 t^2 - 15640000 t^3 + 6120000 t^4)/1127;
V3[t_]:= 4(661257 - 3118500 t + 5512500 t^2 - 4312000 t^3 + 1260000 t^4)/99;
flat1 = Graphics[Line[{{0,120},{1/20,120}}]];
flat2 = Graphics[Line[{{7/20,50},{2/5,50}}]];
zero1 = Graphics[Line[{{0,0},{1/20,0}}]];
zero2 = Graphics[Line[{{7/20,0},{2/5,0}}]];
vol1 = Plot[V1[t],{t,1/20,7/20}];
vol2 = Plot[V2[t],{t,2/5,3/4}];
vol3 = Plot[V3[t],{t,3/4,9/10}];
phi1[t_]:= cc ArcTan[-c q1[t]];
phi2[t_]:= cc ArcTan[-c q2[t]];
phi3[t_]:= cc ArcTan[-c q3[t]];
opt1 = FindMinimum[phi1[t],{t,0.1,0.2}];
t1 = t/.opt1[[2]];a1 = opt1[[1]];
opt2 = FindMinimum[-phi1[t],{t,0.3,0.35}];
t2 = t/.opt2[[2]];a2 = -opt2[[1]];
opt3 = FindMinimum[-phi2[t],{t,0.45,0.55}];
t3 = t/.opt3[[2]];a3 = -opt3[[1]];
opt5 = FindMinimum[-phi3[t],{t,0.75,0.85}];
t5 = t/.opt5[[2]];a5 = -opt5[[1]];
circ1 = Graphics[Disk[{t1,a1},circpars],
	AspectRatio->Automatic];
circ2 = Graphics[Disk[{t2,a2},circpars],
	AspectRatio->Automatic];
circ3 = Graphics[Disk[{t3,a3},circpars],
	AspectRatio->Automatic];
circ4 = Graphics[Disk[{3/4,0},circpars],
	AspectRatio->Automatic];
circ5 = Graphics[Disk[{t5,a5},circpars],
	AspectRatio->Automatic];
ucirc1 = Graphics[Disk[{t1,V1[t1]},circpars],
	AspectRatio->Automatic];
ucirc2 = Graphics[Disk[{t2,V1[t2]},circpars],
	AspectRatio->Automatic];
ucirc3 = Graphics[Disk[{t3,V2[t3]},circpars],
	AspectRatio->Automatic];
ucirc4 = Graphics[Disk[{3/4,V3[3/4]},circpars],
	AspectRatio->Automatic];
ucirc5 = Graphics[Disk[{t5,V3[t5]},circpars],
	AspectRatio->Automatic];
	
yfoc1 = V1[tfoc1];
gradfoc1 = Tan[phi1[tfoc1]/cc]/c;
yr1 = yfoc1 + gradfoc1(tr1-tfoc1);
ts1 = tfoc1 + (tr1-tfoc1)Sec[phi1[tfoc1]/cc];
line1dot = Graphics[{Dashing[{0.001,0.01}],
				  Line[{{tfoc1,yfoc1},{tr1,yr1}}]}];
line1dash = Graphics[{Dashing[{0.01,0.01}],
				  Line[{{tfoc1,yfoc1},{ts1,yfoc1}}]}];
sector1 = Graphics[{GrayLevel[0.65],Disk[{tfoc1,yfoc1},
			{tr1-tfoc1,(tr1-tfoc1)/c},{phi1[tfoc1] Degree, 0}]}];
text1 = Graphics[Text["-51 degrees",{tfoc1+0.25,yfoc1-20}]];

yfoc2 = V2[tfoc2];
gradfoc2 = Tan[phi2[tfoc2]/cc]/c;
yr2 = yfoc2 + gradfoc2(tr2-tfoc2);
ts2 = tfoc2 + (tr2-tfoc2)Sec[phi2[tfoc2]/cc];
line2dot = Graphics[{Dashing[{0.001,0.01}],
				  Line[{{tfoc2,yfoc2},{tr2,yr2}}]}];
line2dash = Graphics[{Dashing[{0.01,0.01}],
				  Line[{{tfoc2,yfoc2},{ts2,yfoc2}}]}];
sector2 = Graphics[{GrayLevel[0.65],Disk[{tfoc2,yfoc2},
			{(tr2-tfoc2)/2,(tr2-tfoc2)/(2c)},{0,phi2[tfoc2] Degree}]}];
text2 = Graphics[Text["+24 degrees",{tfoc2+0.2,yfoc2+5}]];
	
vol = Show[vol1,flat1,flat2, vol2,vol3, 
	ucirc1, ucirc2, ucirc3, ucirc4, ucirc5,
	sector1,line1dot,line1dash,text1,
	sector2,line2dot,line2dash,text2,
	PlotRange->{{0,9/10},{0,125}}, AxesLabel->{"t"," "},
	PlotLabel->"(a) Volume of Blood in Left Ventricle (ml)",
	Ticks->{horizontalticks,Automatic},
	AspectRatio->correctionfactor/GoldenRatio];
angle1 = Plot[phi1[t],{t,1/20,7/20}];
angle2 = Plot[phi2[t],{t,2/5,3/4}];
angle3 = Plot[phi3[t],{t,3/4,9/10}];
elevation = Show[angle1,angle2,angle3,zero1,zero2,
	circ1, circ2, circ3, circ4, circ5,
	AxesLabel->{"t"," "},
	PlotLabel->"(b) Elevation of Graph (degrees)",
	Ticks->{horizontalticks,Automatic},
	PlotRange->{{0,9/10},{-67,65}}];
Show[GraphicsArray[{{vol},{elevation}}],PlotLabel->"Figure 3.1"]