Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

matlab question a) Write a MATLAB user-defined function, freefall(), that computes the velocity and the distance of a free fall object, given its initial position

matlab question image text in transcribed
a) Write a MATLAB user-defined function, freefall(), that computes the velocity and the distance of a free fall object, given its initial position and the time travelled as two input arguments. The velocity and the distance of a free fall object can be written as: y = gt y=% + gt where yo is the initial position, t is the time travelled and g is the acceleration due to gravity (-9.81 m/s?). The initial position can only be a scalar value, and thus the function can only work with a scalar input for this value. The time traveled can be a MATLAB vector array or a scalar, and the function should work if either of these are input for this variable. The function should display an error message if a negative time is input. Do not forget to include proper comments. Flow chart is NOT required. b) Use the user-define function created in Part a). Write the proper MATLAB statement(s) to compute the velocity (v) and the travelled distance (y) for a free fall object with the initial position (yo) of 20 meters and the time ranging from 0 to 10 seconds, step 0.1s. Use the subplot function to plot, on the same figure window, the time versus the velocity and the time versus the travelled distance. Do not forget to include proper comments in the code. A Flow chart is NOT required

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students also viewed these Databases questions

Question

Have roles been defined and assigned?

Answered: 1 week ago