Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Matlab. The time dependent height, h, and horizontal distance, x, a projectile travels can be described by the following functions: h(t) = vtsin theta -
Matlab.
The time dependent height, h, and horizontal distance, x, a projectile travels can be described by the following functions: h(t) = vtsin theta - 1/2 gt^2 x(t) = vtcos theta where time, t is in seconds, velocity, v, is in m/s, the angle of launch, theta, is in radians, and acceleration due to gravity, g, is 9.8 m/s^2. a. Open a new script in MATLAB. b. Define the acceleration due to gravity. c. Use colon notation to create a vector, t, containing values of time from 0 to 10 seconds in increments of 0.1 s. d. Use the input function to ask the user to input a velocity between 1 and 100 m/s and a launch angle between 0 and 90 degrees; assign these values to variables v and theta, respectively. e. Convert theta to radians using the following line of code: theta = theta*pi/180;. f. Use the MATLAB built-in function length() to calculate the number of values in the vector t, and assign this length to the variable len_t. g. Use a single for loop to calculate vectors of height, h, and horizontal distance, x for each time value in the vector t. Begin the for loop with for i = 1:len_t, so that i represents the position in each vector. h. Use subplot and plot to produce three plots, h vs t, x vs t, and h vs x, on a single page. Label all axes and include descriptive plot titles. i. Run your script using a launch angle of 40 degree and a velocity of 65 m/s. Print the figure produced and draw by hand on the printout where the plots are no longer physically meaningfulStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started