Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Placing the element to the specific area if the condition is satisfied.
1 回表示 (過去 30 日間)
古いコメントを表示
I want to write a code for the below problem. A rectangular area is assumed that encompass the area (C) of my problem. The area that are outside of area (C) are represented by exterior, E. The rectangle is the sum of C and E.
The condition is as follows-
In exterior E : e > 0 (e is the deformed distance in my problem)
In actual contact C : e ==0
If e > 0, the element is in the exterior, E
And, if e == 0, the element is in the contact, C
How to write a code in matlab for such a case?
0 件のコメント
回答 (1 件)
Suryaansh Mata
2019 年 6 月 18 日
Define the area of the rectangle using the two parameters 'x' and 'y'. Now define the range for x and y for the regions E and C. Next make use of AND, OR operators in the if elseif else check blocks to incorporate the logic. A sample example can be.
0 <= x <=10
0<= y < 5 consists of area E
5< y <= 10 consists of area C
This is the region of the rectangle
Now make use of the if conditions as follows
if (y<5)
area is in E
elseif (y==5)
area is in contact
else
area is in C
end
This should be a correct approach to the given problem
1 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!