1 view (last 30 days)

function out = g(x1 , x2)

out = x1 * x2 - 1140;

function [dGdX1 dGdX2] = dGdX(x1 , x2)

dGdX1 = x2 ;

dGdX2 = x1 ;

clc ;

clear ;

close a l l ;

format short g ;

% −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− %

mu_x1 = 38;

sigma_x1 = 3.8;

mu_x2 = 54;

sigma_x2 = 2.7;

x1 = mu_x1

x2 = mu_x2

[dg_dx1 dg_dx2] = dGdX(x1 , x2 ) ;

g_ = g(x1 , x2)

beta = g_ / sqrt (( dg_dx1 * sigma_x1)^2 + (dg_dx2 * sigma_x2)^2)

alpha_1 = -dg_dx1 * sigma_x1 / sqrt (( dg_dx1 * sigma_x1)^2 +...

(dg_dx2 * sigma_x2 )^2);

alpha_2 = -dg_dx2 * sigma_x2 / sqrt (( dg_dx1 * sigma_x1)^2 +...

(dg_dx2 * sigma_x2 )^2);

u1 = beta * alpha_1 ;

u2 = beta * alpha_2 ;

x1 = mu_x1 + u1 * sigma_x1

x2 = mu_x2 + u2 * sigma_x2

epsilon = 1.0;

while epsilon > 1E-3

g_ = g(x1 , x2)

[dg_dx1 dg_dx2] = dGdX(x1 , x2 ) ;

beta_old = beta ;

beta = (g_ - dg_dx1 * sigma_x1 * u1 - dg_dx2 * sigma_x2 * u2 )...

/ sqrt (( dg_dx1 * sigma_x1)^2 + (dg_dx2 * sigma_x2)^2)

epsilon = abs( beta - beta_old ) / beta_old

alpha_1 = -dg_dx1 * sigma_x1 / sqrt (( dg_dx1 * sigma_x1)^2 +...

(dg_dx2 * sigma_x2 )^2);

alpha_2 = -dg_dx2 * sigma_x2 / sqrt (( dg_dx1 * sigma_x1)^2 +...

(dg_dx2 * sigma_x2 )^2);

u1 = beta * alpha_1 ;

u2 = beta * alpha_2 ;

x1 = mu_x1 + u1 * sigma_x1

x2 = mu_x2 + u2 * sigma_x2

end

can any one help?

Kuifeng
on 10 Apr 2016

%Remove the following lines from the code

clc ;

clear ;

close a l l ;

Walter Roberson
on 11 Apr 2016

Opportunities for recent engineering grads.

Apply TodayFind the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
## 2 Comments

## Direct link to this comment

https://uk.mathworks.com/matlabcentral/answers/278162-it-is-showing-not-enough-input-arguments#comment_357432

⋮## Direct link to this comment

https://uk.mathworks.com/matlabcentral/answers/278162-it-is-showing-not-enough-input-arguments#comment_357432

## Direct link to this comment

https://uk.mathworks.com/matlabcentral/answers/278162-it-is-showing-not-enough-input-arguments#comment_357435

⋮## Direct link to this comment

https://uk.mathworks.com/matlabcentral/answers/278162-it-is-showing-not-enough-input-arguments#comment_357435

Sign in to comment.