Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Could someone please help me with these MATLAB application problems? Thank you! Application 6: Iteration ENGR 1221 Designed to rest with: looping, user-defined functions, iteration

Could someone please help me with these MATLAB application problems? Thank you!
image text in transcribed
image text in transcribed
image text in transcribed
Application 6: Iteration ENGR 1221 Designed to rest with: looping, user-defined functions, iteration For this assignment, submit All of the following: function file (.m), script file.ml, and text output file (.txt) Substituting into the second equation: Vin (sin o) [R/ [V... cos 0V - XBR/(V. cose.VP-H sin -H+79 (l, cos 8 +V) Kun (rocos 0 +0.) - Since this equation has trigonometric functions of on both sides, it cannot be solved analytically, an iterative solution is more practical. In a computer algorithm, this takes the form of a recursion relation", which relates the next estimate for to the previous one: 1 sin- cos8, +V.) This equation says that if you have an estimate for the angle, you can put that into the right hand side of the equation and getter a better estimate, ... Then insert that better estimate on the right-hand side and get an even better one. Continue until the difference between and is very small Tasks 1. Write a function that calculates the launch angle, given the target range, altitude and velocity and cannon's muzzle velocity. Function specifications: Input arguments: Range (R) in meters; Altitude (H) in meters; Target velocity (M) in m/s; Muzzle velocity (Vm) in m/s [NOTE: for compatibility with the checker, the arguments must be in this order and the tolerance must be 0.001 or better.) Output argument: The required launch angle in degrees. Use the following test case to validate your function: R = 7,000 m; H = 2,500 m; V- 225 m/s; Vm = 1,000 m/s 0 2565 2. Write a script to apply your function from task 1 to a set of provided target data. Application 6: Iteration ENGR 1221 Designed to test skills with looping, user defined functions, iteration For this assignment, submit All of the following: function filem serie output file (.txt) mand text Load the target data from the provided Excel file, targets.is, Into a matrising the command you don't have to use the variable name data can be whatever you data-xlaread("targets.xlsx Each row of the data file contains the parameters for one target in the following order: Range, Altitude, Velocity Use a fixed value of 1,000 m/s for Vm. b. Loop over the targets, calling the iterative solver function to determine the launch angle for each one Extract the parameters from the data array that you created in 2a: do not hard-code the numbers or the number of targets in other words, your program should work just as well if applied to a different data file) Store the solutions (the calculated launch angles) in a row vector called angles (This is for compatibility with the checker.) 3. Write to a text file a table in this format the angles shown are not the correct solutions using fprintf statements. Hint: use it and infortable formatting Loops can make this process faster) Use type of fileread to display the text file to the command window Target Range (km) Altitude (km) Velocity(m/s) Launch Angle 3.0 250 22.05 10.0 8.0 325 19.35 110 225 23.22 18.73 12.5 1.75 275 17.96 Solution Hints IMPORTANT: The equations were derived assuming that is a POSITIVEbersome people mative convention in which give number, but for purpose of this As a t otal och ED Templates.zip | Powered b 2019 APP 06C_Pipe pot i Poe 2019 SWAPP 070.pd Target Atitude Velocity / Launch Angle 22.05 10.0 250 4.0 19.35 2322 140 1873 125 275 17.96 Solution Hints IMPORTANT: The equations were derived assuming that is a POSITIVE number. Some people use an ternative convention in which is a negative number, but for purposes of this assignment -9.81) As a starting assumption, assume that is small, so that cos 1. A first estimate for can then be calculated from the equation. Insert this first estimate into the right hand side of the equation and solve to get a second estimate, etc. Application 6: Iteration ENGR 1221 Designed to test skills with: looping, user-defined functions, iteration For this assignment, submit All of the following: function file (.m), script file (.m), and text output file (.txt) if you aren't interested in mechanics, you don't have to work through the equations. Just focus on the final equation relating to Before worrying about all the programming details, just get the basic calculation to work. As a first rough cut, you can put the equation in a for loop and execute a fixed number of times: 10 should be more than enough. Once you have this working, replace the for loop with a while loop so that you only perform as many iterations as necessary

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions