Homework 4 - EGM 3344 Sorting Number: 190 Problem Set: 4...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
EGM 3344 Sorting Number: 190 Problem Set: 4 Problems completed: 7.4, 7.5, 7.6, 12.1, 12.5, 12.6, 12.6unconstrained, 12.8
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Problem 7.4 Code and Solution: %Problem 7.4 x = [-2:0.1:2]; f = [-1.5 0 -2 0 0 12 0]; plot(x,polyval(f,x)) df = polyder(f); ddf = polyder(df); polyval(ddf,x) xl = 0; xu = 2; i = 1; for i = (1:15) xr = (xl+xu)/2; fxl = polyval(df,xl); fxu = polyval(df,xu); fxr = polyval(df,xr); if fxu*fxr >= 0 xu = xr; else xl = xr; end xrold = xr; i = i+1; end x = xr y = -1.5*x.^6 - 2*x.^4 + 12*x -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 -160 -140 -120 -100 -80 -60 -40 -20 0 20
Background image of page 2
ans = Columns 1 through 12 -816.0000 -673.0845 -550.1520 -445.2045 -356.3520 -281.8125 -219.9120 -169.0845 -127.8720 -94.9245 -69.0000 -48.9645 Columns 13 through 24 -33.7920 -22.5645 -14.4720 -8.8125 -4.9920 -2.5245 -1.0320 -0.2445 0 -0.2445 -1.0320 -2.5245 Columns 25 through 36 -4.9920 -8.8125 -14.4720 -22.5645 -33.7920 -48.9645 -69.0000 -94.9245 -127.8720 -169.0845 -219.9120 -281.8125 Columns 37 through 41 -356.3520 -445.2045 -550.1520 -673.0845 -816.0000 x = 0.9169 y = 8.6979
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Problem 12.1 Code and Solution: %Problem 12.1 function Rao_1 format short x0 = 0.1*ones(2,1); options = optimset( 'Display' , 'Iter' , 'MaxIter' ,100, ... 'MaxFunEvals' ,500, 'LargeScale' , 'off' ); A = []; b = []; Aeq = []; beq = []; LB = ones(2,1); UB = []; x = fmincon(@cost,x0,A,b,Aeq,beq,LB,UB,@constraints,options) %=========================================================== function f = cost(x) x1 = x(1,1); x2 = x(2,1); f = 8.46*x1*x2; %=========================================================== function [C,Ceq] = constraints(x) x1 = x(1,1); x2 = x(2,1); C = zeros(2,1); C(1,1) = (3.6/(x1^3*x2))-1.0; C(2,1) = (9/(x1^2*x2))-1.0; Ceq = []; EDU>> Rao_1 Max Line search Directional First-order Iter F-count f(x) constraint steplength derivative optimality Procedure 0 3 8.46169
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

Homework 4 - EGM 3344 Sorting Number: 190 Problem Set: 4...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online