# Matlab代写｜MaESE 4481 ASSIGNMENT #4

这是一篇美国的MATLAB无人机动力学代码代写

You may work with a partner on this assignment, but please write your reports separately. Please maintain your hard work, your integrity, and your gumption. I am proud to be your teacher.

Data from a flying parrot UAV is posted in Canvas. The data is available in the System Identification Data Module. Use this data to model the control effectiveness and motors.

(1) A symmetric bang-bang command was injected, one virtual input at a time (throttle, aileron, rudder, elevator).

(2) With the UAV in a hover, a chirp command was injected, one motor at a time (*n*1*, n*2*, n*3*, n*4).

(3) The UAV was maintained in a hover with its control system active. This data is useful to determine the effect of decreasing battery voltage on motor performance.

(4) For the assignment, it may be helpful to filter and post process data used for identification. Use your engineering judgement when filtering your data.

There is a trade-off (just like with stability) that incorporating filtering decreases the resolution of the estimated information; it may, however,mitigate artifacts from noise. Some of the data we provided comes from a Kalman filter.

(1) Construct 4 parametric representations of your UAV’s linear, SIMO dynamics using the bang-bang command data.

Start from the assumption that the parameters in the aircraft model are as follows:

(3.1)

Let *x*1*, x*2*, *and *u *correspond to the following triples:

You will identify *c *in these models of the UAV using parametric identification. We use the assumptions from lecture to represent these dynamics discretely (ZOH, uniform I/O sampling) to digitally transform (3.1)

were derived under the assumptions in lecture (ZOH, uniform I/O sampling). *The purpose of this part of the assignment is to anchor our **model of the UAV to real data *

(2) There is a relationship between battery voltage and the motor output. It has been observed that the steady-state performance of the motors degrades as this voltage decreases. The steady-staate motor speed command *η**c *need to increase so that the actual steady-state motor speed *η**a *trims the UAV to 1-g as the battery voltage of the UAV drops. Determine a relationship between the trim motor speed command *η**c *and voltage. Let this relationship be a function *f *of the ratio of the current battery voltage *V *to the max battery voltage *V*0*, *i.e.,

*η**a/**η**c *= *f*(*V /V*0)*. *

(3) Use non-parameteric identification to identify a transfer function that represents the parrot’s actuator, *H**i*(*s*)

*η**a,i/**η**c,i *= *H**i*(*s*)

where *n**a,i *is the achieved angular velocity of the *i*th motor and *n**c,i *is the commanded angular velocity out of the control system. Utilize the chirp data set for this task. You will need to utilize your parametric estimate.

The transfer function should take the following form

*H**i*(*s*) = （*η**a/**η**c）**e-**τ**d**s /**τ**a**s *+ 1*, *

where *τ**d *is the delay time and *τ**a *is the motor time constant.

Please submit all Simulink models, codes, pertaining to this work into Canvas.

(1) Explains the purpose of this system identification assignment

(2) Present the identified dynamics for the linear systems in the continuous domain.

(3) Present the transfer functions identified for each motor

(4) Present the relationship between battery voltage and motor performance

(5) Explains the practical implications you learned about modeling from this assignment.

(6) Discuss how might these challenges constructing models may shape the cost, safety, or efficacy of an engineering system you are interested in

Use the log chirp and voltage data.zip data for motor modeling. To model the effectiveness of control inputs use the bang bang data.zip data .

The data is split up into different folders for chirp on each of the 4 motors and bang-bang for T, E, A, R. Within each of those folders there should be a few different.MAT files. NOTE: The bang-bang doublets are a little off for TEAR commands -a doublet should have a step up, then a step down 2x larger than the initial step up, then another step up the same size as the initial step. Instead, the bang bang commands have a step up, then a step down 3x larger than the initial step, then a step up 2x larger than the initial step. For example, the throttle doublet actually steps motor speeds up 10 Hz, then down 30 Hz, then up 20 Hz (rather than up 10 Hz, down 20 Hz, up 10 Hz). This shouldn’t make a difference and will still work with your system ID calculations, but just be sure to look at the bang bang/chirp commands in motor speed data and know what you’re using for your calculations.

The chirp was a logarithmic chirp ranging from 0 Hz to 100 Hz over a period of 10 seconds, and it was applied to all four motors simultaneously. The entire flight for each of the trials was 25 seconds long, and the logarithmic chirp was input to the motors from *t *= 10 seconds to *t *= 20 seconds. (Note that in chirp data, the logarithmic chirp occurs from 0 sec to 10 sec, then repeats from 10 sec to 20 sec,and then it begins to repeat once again at 20 sec. Only the chirp from 10 sec to 20 sec was input to the drone, as a switch was used to only pass through the chirp from 10 to 20 sec.) Plots of the motor speeds over the entire flight duration were included so you can see where the chirp occurred (this should be pretty obvious on the plots where amplitude is 10, 20, and 50).

6.1. **Description of Mat files. **Data was recorded for 5 different trials. For each of the 5 trials, the amplitude of the logarithmic chirp was 1, 5, 10, 20, and 50.

The data called chirp data should have 4 columns, and each column is the chirp signal applied to the respective motor. Note, direction is not accounted for here,so all four columns should be identical. Additionally, the chirp was only applied to the motors from *t *= 10 sec. to *t *= 20 sec, which should be row 2000 to row 4000 in this data set.

The data called motor speed data is the motor speed for each of the four motors in Hz. Motor direction IS accounted for here, so motors 1 and 3 are positive values,and motors 2 and 4 are negative values.

The data called sensor data contains the raw sensor data from the UAV for [a x,a y, a z, p, q, r, h, h prs] (these are listed in order of the columns, so column 1 is a x, and column 8 is h prs). a x, a y, and a z are the acceleration data from the accelerometer, and p, q, and r are the angular rate data from the gyroscope. h is the altitude data from the ultrasound sensor, and h prs is the altitude data from the pressure sensor.

The data called state est data is the data from the state estimator. It is composed of 13 columns with data for [time, x, y, h, psi, theta, phi, u, v, w, p, q, r] in that order.

The data called y fil is some slightly processed data used for the control system[u, v, a x, a y, a z, p, q, r, phi, theta, psi, h].