Beruflich Dokumente
Kultur Dokumente
Problem1:SimulatingStateSpaceModels
Part1b:StableSystems
Simulatethegivensystemasstatedintheproblem.
In[3]: # YOUR CODE HERE #
A = np.matrix('0.7 0.2; 0.8 0.35')
print(np.linalg.eigvals(A))
def fx(k):
x0 = []
x1 = []
for i in k:
x = (A**i)*np.matrix('1; 0.2')
x0.append(np.matrix.item(x[0]))
x1.append(np.matrix.item(x[1]))
return x0, x1
def x_0(k):
return fx(k)[0]
def x_1(k):
return fx(k)[1]
k = np.arange(21)
plt.figure()
plt.plot(k,x_0(k))
plt.plot(k,x_1(k))
[ 0.96160623 0.08839377]
Out[3]: [<matplotlib.lines.Line2D at 0x7f2a6b275240>]
Part1d:UnstableSystems
Simulatethegivensystemasstatedintheproblem.
Problem2:OpenLoopUAVControl
Basedontheparametersgivenfortheproblem,writecodebelowtosimulatetheUAVinresponsetoa(noisy)stepinputof4.9N.
NowcallyourfunctionsandplottheresultstosimulatethebehavioroftheUAV.
HowwelldoestheUAVmaintainitsinitialposition?
Notverywell.
Problem3:ClosedLoopUAVControl
Basedontheparametersgivenfortheproblem,writecodebelowtosimulatetheUAVinclosedloopconfiguration.
NowcallyourfunctionsandplottheresultstosimulatethebehavioroftheUAV.
Nowrepeattheexperiment,butuseadifferentvalueofh todefinenewstatematrices.
In[13]: # Define the new A_CL and B_CL matrices; use h = 800 N/(m/s)
# YOUR CODE HERE #
h = 800
m = 0.5
A_CL = np.matrix(np.array([[1, Ts-h*(Ts**2)/(2*m)], [0, 1-h*Ts/m]]))
B_CL = np.matrix(np.array([[(Ts**2)/(2*m)], [Ts/m]]*np.array([h, 1])))
Forthefirstfiveseconds,howwelldoestheUAVrespondtothenoiseinthesystem?Doesitremainatthedesiredheight?
Itovershootsthedesiredheight.
Afterthestepchangeinvd ,howdoestheUAVrespondtothechangeindesiredvelocity?
Itrespondsbyflyingup.
HowdoestheUAVbehaviorchangewithdifferentvaluesofh ?
Lowervaluesofhaffectstheheightless.