# How to replace an array of symbolic variable in optimization problem?

2 ビュー (過去 30 日間)
Md. Monirul Islam 2019 年 1 月 28 日
コメント済み: Alan Weiss 2019 年 1 月 29 日
I have a 3D array of symbolic variable. 1st row of the array is like below:
syms x111 x112 x113 x114 x115 x116 x117 x118 x119 x1110 x1111 x1112 real
NVFMS(1,1,:)=[x111 x112 x113 x114 x115 x116 x117 x118 x119 x1110 x1111 x1112];
These variables are used in all objective function and constraints. How can I update all the variables in a loop of 10 iteration?

#### 0 件のコメント

サインイン to comment.

### 回答 (2 件)

Alan Weiss 2019 年 1 月 29 日
I do not understand what you are asking. But perhaps these examples will allow you to help yourself in using symbolic math with optimization functions:
Alan Weiss
MATLAB mathematical toolbox documentation

#### 0 件のコメント

サインイン to comment.

Md. Monirul Islam 2019 年 1 月 29 日
In my problem, there are the following steps:1) defining the symbolic variables, 2) initialize the symbolic variables, 3) updating the symbolic variable with the iteration. I have initialized the symbolic variable values and initialize the values using subs command. However, I couldn't update the values automatically inside the loop.

#### 1 件のコメント

Alan Weiss 2019 年 1 月 29 日
I'm sorry, but I still do not know what you mean "I couldn't update the values automatically inside the loop." If you give some code then maybe we can understand what you are trying to do.
By the way, are you trying to perform a numerical optimization? If so, then it is usually wise not to use symbolic variables in the optimization, but instead to use functions (perhaps converted from symbolic using matlabFunction) and a numerical optimizer such as fmincon.
Alan Weiss
MATLAB mathematical toolbox documentation

サインイン to comment.

サインイン してこの質問に回答します。

Translated by