Chapter 3 Graphical Optimization and Basic Concepts
MATLAB Code
%Create a grid from -5 to 15 with an increment of 0.05 for the variables r and t
[r,t]=meshgrid(-5:0.05:15, -5:0.05:10);
hold on %retains the current plot and axes properties for all subsequent plots
%Use the “contour” command to plot constraint/minimization functions
cv1=[0:0.01:0.5]; %Specifies contour values
const1=contour(r,t,g1,cv1,’g’);
cv1=[0 0.001];
const4=contour(r,t,g4,cv4,’g’);
cv4=[0 0.001];
const4=contour(r,t,g4,cv4,’k’);
fv=[10 73 80 128]; %Defines contours for the minimization function
fs=contour(r,t,f,fv,’b’);