Você está na página 1de 21

Manish Bhattarai--------------------------------------ceodspspectrum@unm.

edu
1.a

The computation for eigen vector and values are shown as follows
The corresponding contour plot is shown as

% script to plot the mesh plot and the contour plot for the function
% f(x) = +5*x1^2+10*x2^2
close all;
[x1,x2] = meshgrid(-10:0.2:10,-10:0.2:10);
f = 5*x1.^2+10*x2.^2;
figure;
meshc(x1,x2,f);
xlabel('x_1','FontSize',12);
ylabel('x_2','FontSize',12);
zlabel('f(x)','FontSize',12);
title('Mesh and Contour Plot of f(x) = 5*x1^2+10*x2^2',...
'FontSize',12);
legend('mesh plot');
hold on;
text(.1,-.1, 'The function has a minima at (x1,x2)=(0,0)', ...
'Units', 'normalized', ...
% Not depending on the data
'HorizontalAlignment', 'left', ...
'VerticalAlignment', 'bottom');%Remarks and Observation
plot(0,0,'k*');

%
figure;
contour(x1,x2,f,25);
hold on;

line([-10 10],[0 0],'Color','k','LineStyle','-.');


line([0 0],[-10 10],'Color','k','LineStyle','-.');
%plot(0,0,'k*');
hold off;
xlabel('x_1','FontSize',12);
ylabel('x_2','FontSize',12);
title('Contour Plot of f(x) = 5*x1^2-10*x2^2 and representation of eigen
space for lambda= 10,-20 along (0,1) and (1,0)', ...
'FontSize',12);
legend('Contour plot');
text(-.15,-.1, 'Remarks and Observation::Along the direction of eigen
vectors,one can observe the function is undergoining principal changes and it
is growing along lamda=10 ie along (0,1) and lambda=20 ie. along (1,0) ', ...
'Units', 'normalized', ...
% Not depending on the data
'HorizontalAlignment', 'left', ...
'VerticalAlignment', 'bottom');%Remarks and Observation

1b::
The computation for eigen vector and values are shown as follows
The corresponding contour plot is shown as

% script to plot the mesh plot and the contour plot for the function
% f(x) = +5*x1^2-10*x2^2
close all;
[x1,x2] = meshgrid(-10:0.2:10,-10:0.2:10);
f = 5*x1.^2-10*x2.^2;
figure;
meshc(x1,x2,f);
xlabel('x_1','FontSize',12);
ylabel('x_2','FontSize',12);
zlabel('f(x)','FontSize',12);
title('Mesh and Contour Plot of f(x) = 5*x1^2-10*x2^2',...
'FontSize',12);
legend('mesh plot');
hold on;
text(.1,-.1, 'The function has a minima at (x1,x2)=(0,0)', ...
'Units', 'normalized', ...
% Not depending on the data
'HorizontalAlignment', 'left', ...
'VerticalAlignment', 'bottom');%Remarks and Observation
plot(0,0,'k*');
%
figure;
contour(x1,x2,f,25);
hold on;

line([-10 10],[0 0],'Color','k','LineStyle','-.');


line([0 0],[-10 10],'Color','k','LineStyle','-.');
%plot(0,0,'k*');
hold off;
xlabel('x_1','FontSize',12);
ylabel('x_2','FontSize',12);
title('Contour Plot of f(x) = 5*x1^2-10*x2^2 and representation of eigen
space for lambda= 10,-20 along (0,1) and (1,0)', ...
'FontSize',12);
legend('Contour plot');
text(-.15,-.1, 'Remarks and Observation::Along the direction of eigen
vectors,one can observe the function is undergoining principal changes and it
is growing along lamda=10 ie along (0,1) and lambda=-20 ie. along (1,0) ',
...
'Units', 'normalized', ...
% Not depending on the data
'HorizontalAlignment', 'left', ...
'VerticalAlignment', 'bottom');%Remarks and Observation

1 C.
The computation for eigen vector and values are shown as follows
The corresponding contour plot is shown as

% script to plot the mesh plot and the contour plot for the function
% f(x) = -5*x1^2-10*x2^2
close all;
[x1,x2] = meshgrid(-10:0.2:10,-10:0.2:10);
f = -5*x1.^2-10*x2.^2;
figure;
meshc(x1,x2,f);
xlabel('x_1','FontSize',12);
ylabel('x_2','FontSize',12);
zlabel('f(x)','FontSize',12);
title('Mesh and Contour Plot of f(x) = -5*x1^2-10*x2^2',...
'FontSize',12);
legend('mesh plot');
hold on;
text(.1,-.1, 'The function has a minima at (x1,x2)=(0,0)', ...
'Units', 'normalized', ...
% Not depending on the data
'HorizontalAlignment', 'left', ...
'VerticalAlignment', 'bottom');%Remarks and Observation
plot(0,0,'k*');
%
figure;
contour(x1,x2,f,25);
hold on;

line([-10 10],[0 0],'Color','k','LineStyle','-.');


line([0 0],[-10 10],'Color','k','LineStyle','-.');
%plot(0,0,'k*');
hold off;
xlabel('x_1','FontSize',12);
ylabel('x_2','FontSize',12);
title('Contour Plot of f(x) = -5*x1^2-10*x2^2 and representation of eigen
space for lambda= -10,-20 along (0,1) and (1,0)', ...
'FontSize',12);
legend('Contour plot');
text(-.15,-.1, 'Remarks and Observation::Along the direction of eigen
vectors,one can observe the function is undergoining principal changes and it
is growing along lamda=-10 ie along (0,1) and lambda=-20 ie. along (1,0) ',
...
'Units', 'normalized', ...
% Not depending on the data
'HorizontalAlignment', 'left', ...
'VerticalAlignment', 'bottom');%Remarks and Observation
1.d
The computation for eigen vector and values are shown as follows
The corresponding contour plot is shown as

% script to plot the mesh plot and the contour plot for the function
% f(x) = 5*x1^2
close all;
[x1,x2] = meshgrid(-10:0.2:10,-10:0.2:10);
f = 5*x1.^2;
figure;
meshc(x1,x2,f);
xlabel('x_1','FontSize',12);
ylabel('x_2','FontSize',12);
zlabel('f(x)','FontSize',12);
title('Mesh and Contour Plot of f(x) =5*x1^2',...
'FontSize',12);
legend('mesh plot');
hold on;
text(.1,-.1, 'The function has a Minima along x1=0 plane', ...
'Units', 'normalized', ...
% Not depending on the data
'HorizontalAlignment', 'left', ...
'VerticalAlignment', 'bottom');%Remarks and Observation
plot(0,0,'k*');
%
figure;
contour(x1,x2,f,25);
hold on;

line([-10 10],[0 0],'Color','k','LineStyle','-.');


line([0 0],[-10 10],'Color','k','LineStyle','-.');
%plot(0,0,'k*');
hold off;
xlabel('x_1','FontSize',12);
ylabel('x_2','FontSize',12);
title('Contour Plot of f(x) = 5*x1^2 and representation of eigen space for
lambda= 10,0 along (1,0) and (0,1)', ...
'FontSize',12);
legend('Contour plot');
text(-.15,-.1, 'Remarks and Observation::Along the direction of eigen
vectors,one can observe the function is undergoining principal changes and it
is increasing along lamda=10 ie along (1,0) and constant along (0,1) ', ...
'Units', 'normalized', ...
% Not depending on the data
'HorizontalAlignment', 'left', ...
'VerticalAlignment', 'bottom');%Remarks and Observation

Problem 2:

A diagrammatic illustration is shown as follows

Here the upper surface represents the first function given f(x1,x2)=5*x1^2+10*x2^2 and the lower
surface represents the constraint surface 1-x1^2-x2^2. The solution lies in the bounded intersection of
these two surfaces. For lamda=0 corresponds to minimal point (0,0) which lies inside the boundry and
along the boundary the solution is given by eigen vector corresponding to minimal negative eigenvalue.
The same process can be generalized for the remaining cases

Problem 3.3

Problem 3.6

Você também pode gostar