×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# fgoalattain (Optimization Toolbox)

## fgoalattain (Optimization Toolbox)

(OP)
Continuing on with my quest in optimization, I am looking to find a particular solution using a multi-objective optimization function.  My design variables would be BDLT, BALPHA, BALPHY, and BPHIP.  Fx, Fy, Fz, Mx, My, Mz would be the objective.  The function takes the following form:

[Fx, Fy, Fz, Mx, My, Mz] = aFunc(BDLT, BALPHA, BALPY, BPHIP)

%(where BDLT is a 1x4 Matrix)

After reading up on the optimization functions in Matlab, it looks as though the function fgoalattain would be best for a nonlinear, multiobjective function.  I set up my solver as such:

XO = [0 0 0 0 0 0 0]    % Set initial values to 0; steady state
goal = [0 1 0 0 1 0];     % This is the value that I want to set for [Fx, Fy, Fz, Mx, My, Mz]
weight = abs(goal);    % Equal weight to all goal values
options = optimset('Display', 'iter');     % Set display parameter

[X, fval, attainfactor] = fgoalattain('aFunc', XO, goal, weight, [], [], [], [], [], [], [], options);

I put seven []'s, which should be the seven outputs I want: [BDLT(4), BALPHA, BALPHY, BPHIP].  By my understanding, X should output a vector with the seven values I want, given the defined goal.  I receive the following error:

??? Input Argument "BALPHA" is undefined.

Error in ++> fgoalattain at 371
user_f = feval(funfcn(3), x, varargin(:));

When BALPHA is one of the variables I am trying to solve for!  I'm sure that I'm just not understanding my input and output vectors correctly, but I can't see where I'm going wrong.  Do I need to change some of my variables to constraints?  Thanks in advance for your thoughts.

Replies continue below

### RE: fgoalattain (Optimization Toolbox)

I don't have this toolbox, but almost all solvers and optimizers require an initial guess value.  To expect these algorithms to select a starting point from an infinite set of possibilities is a bit much, don't you think?

The closer to the actual solution you guess, the better off the solver will be.

### RE: fgoalattain (Optimization Toolbox)

(OP)
The form of the equation supplied by the help function is:

x = fgoalattain(func, xO, goal, weight)

which tries to make the objective functions supplied by func attain the goals specified by goal by varying x, starting at xO.  So xO should be the 'initial guess', correct?

I've tried to further simplify the form of my equation by:
[BDLT, BALPHA, BALPHY, BPHIP] = fgoalattain('aFunc', XO, goal, weight)

Where I get the same error message as previously mentioned.  I know that I want BALPHY, BPHIP to be 0, and vary BDLT, BALPHA to achieve the goal.

I've been spinning my gears on this one and not making any progress.  My next step is to continue reading and maybe I'll get a better understanding of this.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!