I am modelling an aircraft and I want to put limits on the throttles or aileron, and all the other powers. How do I connect u values to the limitation I created.

5 views (last 30 days)
u1min = -25*pi/180;
so these are the limits im trying to put in my throttles and aileron as i have 5 different variables for u values. So i want my answer of these connected to the answer i am getting for u1, u2, u3, u4, u5. These are the minimum and maximum values i am trying to input in u values. I am getting answer of u1, u2 as my u1 92*1double and all the rest but it is not getting connected to these limits.

Answers (1)

Image Analyst
Image Analyst on 16 Mar 2022
If u1, u2, etc. are vectors and you want to clip them, you don't use if (unless you want to do it in a loop over all elements), you do it vectorized like
u1 = max([u1, u1min]);
u1 = min([u1, u1max]);
or alternatively
u1(u1 < u1min) = u1min;
u1(u1 > u1max) = u1max;
Then repeat for all the other u's.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!