Quiz #6 Matlab Solutions
Contents
Exercise #1
close all
[x,y]=meshgrid(linspace(-5,5,50));
z=sqrt(x.^2+y.^2);
[c,h]=contour(x,y,z);
clabel(c,h,'manual')
xlabel('x-axis')
ylabel('y-axis')
title('Level curves of f(x,y) = sqrt(x^2 + y^2).')
axis equal
Please wait a moment...
Carefully select contours for labeling.
When done, press RETURN while the Graph window is the active window.
Exercise #4
close all
x=linspace(0,4,40);
y=linspace(-1,3,40);
[x,y]=meshgrid(linspace(-5,5,50));
z=9-x.^2+x.*y-2*y.^2;
L=13-3*x-2*y;
shndl=surf(x,y,z);
set(shndl,...
'FaceColor','Magenta');
hold on
thndl=surf(x,y,L);
set(thndl,...
'FaceColor','Yellow',...
'FaceAlpha',0.5)
xlabel('x-axis')
ylabel('y-axis')
zlabel('z-axis')
title('Linearization of f(x,y) = 9 - x^2 + xy - 2y^2')
view(130,30)