These are my codes:
clear all;
close all;
%parameters
c0 = 14
c1 = 6
c2 = 1
alpha = 4
%% Figure parameters
% Axis bounds
xmin = 0
xmax = 10
ymin = 0
ymax = 10
nmin = 0
nmax = 10
tmin = 0
tmax = 10
%Vector of n values
n = linspace(nmin, nmax, 101)
%Vector of theta values
t = linspace(tmin, tmax, 101)
%Functions
cn = @(n) c0 - c1*n + c2*n.^2
f = @(t) 4.5 + (alpha*t - cn(n)).^(0.5)
g = @(t) 4.5 - (alpha*t - cn(n)).^(0.5)
%Function for the contour plot
E = @(t,n) n.*t
% Give the figure a "handle," so we can modify its properties later
% (see http://www.mathworks.co~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~m/help/matlab/learn_matlab/understanding-handle-graphics-objects.html)
h = figure;
% We allow for multiple overlapping plots
hold on;
% We get rid of the default bounding box
box off;%
% We don't allow Matlab to scale the X-axis differently from the Y-axis
axis equal;
% We set the axis limits
axis([xmin xmax ymin ymax]);
%We plot the egg
plot(f(t),n)
plot(g(t),n)
%plot([xmin,xmax], [ymin),4.5],'k:')
%plot([xopt,xopt],[0,f(xopt)],'k:')
%We plot the contour lines
ezcontour(E,[xmin,xmax,ymin,ymax],101)
%We label the axes
title('Egg graph')
xlabel('')
text(xmax,-0.8,'\theta');
ylabel('')
text(-1,ymax,'n');
set(gca,'XTick',[xmin, xmax]);
set(gca,'XTickLabel',{'0', '10'});
text(alpha,-0.2,'\theta^\ast');
set(gca,'YTick',[ymin, ymax]);
text(-0.5,alpha,'n*');
set(gca,'YTickLabel',{'0','10'})
And this is the graph: 
How do I remove the vertical lines and find the optimum points of ($n*,\theta^*$) when the contour plot touches the egg graph? Is there a way to make the contour plots touch the sides of the egg graph? I want a proper-looking tangency even if I change the parameters of the model - say $\alpha$ or $\check{n}$.
Any help would be appreciated.
I'm trying to replicate this graph below:
