Getting around &/| operator errors in optimization toolbox
4 ビュー (過去 30 日間)
古いコメントを表示
I've got a variable (ER) defined as follows:
ER = XO <= -(Lx-wx)/2 & YO <= -(Ly-wy)/2; % Bottom-left feature of unit cell
ER = ER | XO >= +(Lx-wx)/2 & YO <= -(Ly-wy)/2; % Bottom-right feature of unit cell
ER = ER | XO <= -(Lx-wx)/2 & YO >= +(Ly-wy)/2; % Top-left feature of unit cell
ER = ER | XO >= +(Lx-wx)/2 & YO >= +(Ly-wy)/2; % Top-right feature of unit cell
Here XO and YO are x/y axis meshgrids that range from -Lx/2 to Lx/2 and -Ly/2 to Ly/2 . Lx/Ly are spacings between features and wx/wy are widths of the features. Essentially ER here is getting filled with 1s if its position corresponds to a feature and 0s if not in a meshgrid. For example, with random values for Lx/Ly and wx/wy an image of it shows this:

My issue is that once I change Lx/Ly and wx/wy to optimvars they toolbox doesn't like the &/| operators and throws this error:
Operator '&' is not supported for operands of type 'optim.problemdef.OptimizationInequality'.
Is anyone aware of a way to get the same effect of the code shown without using &/|? I'm sure its something super simple I'm overlooking but I've been staring at a blinking cursor for way too long trying to figure it out. If its something that is fixed in later releases I have no issue updating it.
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with Optimization Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!