x = linspace(-1.5,2,30);
y = linspace(-1,1.5,30);

figure(1); clf
[xx,yy] = meshgrid(x,y);
zzF = xx.^2 + 4*yy.^2 -1;
mesh(xx,yy,zzF)
xlabel('x'); ylabel('y');
axis([min(x),max(x),min(y),max(y),-1,5])
hold on
plot3(x,zeros(size(x)),zeros(size(x)),'b','LineWidth',3);  % x axis
plot3(zeros(size(y)),y,zeros(size(y)),'b','LineWidth',3);  % y axis
t = linspace(0,2*pi);
plot3(cos(t),1/2*sin(t),zeros(size(t)),'r','LineWidth',3)
input('show the tangent plane');
zzPlane = 4 + 2*(xx-1)+8*(yy-1);
mesh(xx,yy,zzPlane)
input('show the solution for the linear equation');
plot3(3-4*y,y,zeros(size(y)),'r','LineWidth',3);  % solution of linear equation
hold off

figure(2); clf
plot(cos(t),1/2*sin(t),'r')
xlabel('x'); ylabel('y');
%axis([min(x),max(x),min(y),max(y),-1,5])
axis([min(x),max(x),min(y),max(y)])
axis equal
hold on
plot(x,zeros(size(x)),'b','LineWidth',1);  % x axis
plot(zeros(size(y)),y,'b','LineWidth',1);  % y axis
plot(3-4*y,y,'r');  % solution of linear equation
input('display the same information for the second equation');
x2 = linspace(-1/sqrt(2),1/sqrt(2),50); y2 = sqrt(1-4*x2.^4);
plot(x2,y2,'g',x2,-y2,'g')
plot(x,7-8*x,'g')
axis([min(x),max(x),min(y),max(y)])
hold off
