Trying to implement the aircraft model in Matlab

1 次查看(过去 30 天)
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.

回答(2 个)

Shah zab
Shah zab 2022-3-17
This is the u1 data result i am getting. On this graph i want a straight line showing u1 data and also u1 min and max together.
0
0.000200715310208309
0.00120429186124985
0.00622217461645757
0.0313115883924962
0.156758657272689
0.596683876196226
1.11639535107343
1.65402642471433
2.25066333746833
2.99257999578268
3.83564228841732
4.57338220113153
5.35350125804668
6.33819645733285
7.42261004256995
8.49560680866748
9.59906752624931
10.6721490462843
11.8626251088340
13.1561003435238
14.3126882443242
15.4613897577599
16.7560813758368
17.8241009768423
19.1556298284143
20.3447338235668
21.6521238141629
22.8104672753526
24.1928744655926
25.3798454612295
26.6951078932947
27.9902136958003
29.0819678379149
29.9999999999998
30
30.0000000000002
31.2843561498250
31.9999999999998
32
32.0000000000005
33.1453796637671
34.2907593275338
35.3844489704656
36.7168039010796
37.9535924061238
39.2894926072720
40.6788756368710
42.0297378957232
43.6645522323964
45.2024151502970
46.9338071841859
48.7738241072855
50.6228052491459
52.5482158430915
54.5782663340044
56.6515304098050
58.7487134040247
60.8848064278339
63.1376588583881
65.6621263895781
68.0970628980705
69.8399222308761
71.5827815636817
73.5022738833100
75.3422613846566
77.2477555043346
78.8462873647703
80.3332745856204
82.0786120012520
84.0463697961261
86.2409476173835
87.5728734667890
88.9047993161945
90.8378633452119
93.2166294392957
95.2260206851787
97.0096652756247
98.6173484085536
100.701793805046
103.192603850185
104.868452694762
106.544301539339
109.363436703190
111.093245192953
112.823053682717
114.777998185810
116.682008767899
118.586019349988
120.496013522625
122.093686173783
123.691358824942
126.184839186057
127.989803077884
129.794766969711
131.563645452774
133.428765788350
135.619999766810
137.525361898245
139.350854143643
140.983596954300
142.855934390983
145.220122677477
147.047575728519
148.875028779560
150.879044686803
152.731849932160
154.584655177516
156.949944809002
158.464188236102
159.978431663202
162.289001027898
164.935729763217
166.717151333460
168.498572903703
170.200026489573
172.340012221568
174.439399634529
176.327959084409
178.114508145602
179.601377627745
180

Arif Hoq
Arif Hoq 2022-3-17
编辑:Arif Hoq 2022-3-17
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)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by