Write a driver script that runs the functions above and


A model of a newly designed aircraft was tested in a wind tunnel. Measurements where made of the effect of air velocity on drag forces. The following measured data was obtained:

v m/s

56.1

70.3

82.8

97.1

111.6

123.8

140.2

D (newtons)

25.3

32.1

48.2

73.0

80.7

110.5

145.7

Where v is the air speed in meters per second and D is the drag force in newtons.

There is doubt about the relationship between D and v. Some suggest that the drag force D is linear in v, but others suspect that the relationship is quadratic.

1. Write a Sci/Matlab function that takes as its input the data and plots the data points and the least squares linear fit to the data. The function should also return the coefficients of the least squares fit.

2. Write another Sci/Matlab function that takes as its input the data and plots the data points and the least squares quadratic fit to the data. The function should also return the coefficients of the least squares fit.

3. Write a driver script that runs the functions above and using the least squares coefficients returned by the functions creates a single plot comparing the differences between the data and the two least squares fit (the residuals of the two fits).

Comment on which approximation is a better fit to the data.

1. Each function needs to be properly commented including a clear description of the purpose of the function, its parameter list and its return values.

For example, in Matlab this means that a user should be able use the help command to obtain information on how to use each function.

2. If multiple files are submitted a text README file which describes each of these functions should also be included.

3. All output data and plots must be properly labeled.

4. Each function should make use of vector/matrix operations where possible.

5. It is perfectly acceptable to make use of any of the built-in Sci/Matlab functions except the polyfit function and the symbolic toolbox.

6. All the appropriate files (including input files) should be submitted as one zip file. This single file should be uploaded via the StudyDesk.

7. The pause command in Matlab and halt command in Scilab should be used to break up the various sections of the assignment in the main driver script and where appropriate in the functions.

Solution Preview :

Prepared by a verified Expert
MATLAB Programming: Write a driver script that runs the functions above and
Reference No:- TGS0996012

Now Priced at $55 (50% Discount)

Recommended (90%)

Rated (4.3/5)