Trying to implement the aircraft model in Matlab
1 view (last 30 days)
Show older comments

The value on u1max and u1min are supposed to be the limitations for the aircraft components and they are supposed to be connected with u1. i want to get the answer for them same as 91*1 double just as for u1.
u1min = -25*pi/180;
u1max = 25*pi/180;
u2min = -25*pi/180;
u2max = 10*pi/180;
u3min = -30*pi/180;
u3max = 30*pi/180;
u4min = 0.5*pi/180;
u4max = 10*pi/180;
u5min = 0.5*pi/180;
u5max = 10*pi/180;
if(u1)>u1max
u1 = u1max;
elseif(u1)<u1min
u1 = u1min;
end
if(u2>u2max)
u2 = u2max;
elseif(u2<u2min)
u2 = u2min;
end
So this is the coding i generated and i also put u1 = u1min and u1max. but the program is not reconizing those calculated u1min and max as the limits. i have seen someone use this code, it wored for them but its not working for me. When i try to plot the graph i only see u1 values as it is not getting connected to u1min and u1max. Is there any way i could connect those limits and get the answer in double.
Answers (2)
Arif Hoq
on 17 Mar 2022
Edited: Arif Hoq
on 17 Mar 2022
i am not so clear about your expectation. my guess
A=load('u1.mat');
u1=A.u1;
u1min = -25*pi/180;
u1max = 25*pi/180;
u2min = -25*pi/180;
u2max = 10*pi/180;
u3min = -30*pi/180;
u3max = 30*pi/180;
u4min = 0.5*pi/180;
u4max = 10*pi/180;
u5min = 0.5*pi/180;
u5max = 10*pi/180;
for n=1:length(u1)
if u1(n)>=u1max
u1(n) = u1max;
elseif u1(n) <= u1min
u1(n) = u1min;
end
end
u1=[u1min;u1]; % if you want u1min. if don't then omit this line
plot(u1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
