syms y
p=.965; m1=.28;b=[2 5 7];c=0.7;
q=.585e-3; m2=.0125; x=pi/4; h1=10; h2=5;
g1=p*sin(x);g2=q*sin(x);a1=(g1.*h1+g2.*h2)/h1;
hfig = figure;
for i=1:length(b)
f=y.*(g1/(2*m1)).*(2.*h1-y)+(g2*h2/m1).*y+b(i);
hPlotf(i)= fplot(f,y,[0,h1]);
hold on;
f1=y.*(g2/(2*m2)).*(2.*(h1+h2)-y)+((g1/(2*m1))-(g2/(2*m2))).*(h1^2)+(g2.*h1.*h2).*((1/m1)-(1/m2))+b(i);
hPlotf1(i) = fplot(f1,y,[h1,15]);
hold on;
end
a=axes('position',get(gca,'position'),'visible','off');
hLf = legend(a,hPlotf,'b = 2','b = 5','b=7','Location','SouthWest');
text(a, hLf.Position(1)-0.1,hLf.Position(2)+0.02,'f');
hLf1 = legend(hPlotf1,'b = 2','b = 5','b=7','Location','NorthWest');
text(a, hLf1.Position(1)-0.1,hLf1.Position(2)+0.02,'f1');
xlabel('y','FontSize', 20);
ylabel('u_2','FontSize', 20);