Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Note: The subject is Matlab... clc clear close all global g theta g = 9.8; % m/s^2 - acceleration due to gravity theta = 60;

Note: The subject is Matlab...

clc

clear

close all global g theta

g = 9.8; % m/s^2 - acceleration due to gravity theta = 60; Vo_arr = [60 80]; % m/s

for k =1:length(Vo_arr) Vo = Vo_arr(k);

% Compute intial velocity components Voy = Vo*sind(theta); Vox = Vo*cosd(theta);

% Computation of the time, tmax to attain maximum height tmax = Voy/g;

% Total flight time = ttol =2*tmax ttot = 2*tmax;

% Computation of maximium height hmax = (Voy)^2/(2*g);

% Let us compute the range, R of the projectile R = (Vox^2)*(sind(2*theta))/g;

% Generate arrays % The time array tarr = 0:0.002:ttot; % the instantaneous height and x arrays harr = Voy *tarr - 0.5 * g* tarr .^2; xarr = Vox *tarr;

% Plots plot(xarr,harr) hold on; grid on; end legend('60','80')

%%%%%%%

Test the script by running it (click on run). It will display a trajectory for a projectile launched at 60

o

with

speed array, Vo_arr of 60 and 80 m/s. This is for you to see the trend.

You will break up the script into two User-defined functions.

Using the script, create

(a). User-defined function that computes and outputs R, ttot, Vox and Voy using the speed, Vo as the

only input.

theta

and

g

are the only global variables. No other global variable should be declared. Note

that R stands for the range and ttot is the total time of flight.

(b). User-defined function that computes harr and xarr and plots(xarr, harr) using Vox,Voy and ttot as the

only input variables. This function should have no output

(d). Write a script that calls these two functions. Use for loops for 4 different Runs of the script for Vo =

70, 80, 100 and 125 m/s. These values should be supplied to the script via the keyboard using the input

command. Using legend label your plots. The plots should be on one figure which you should declare as

Figure 3

(e). Modify your program to use subplot to show each of the above plots on one page. Name the figure as

figure 4

.

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_2

Step: 3

blur-text-image_3

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

l Discuss the contents of an affirmative action plan (AAP).

Answered: 1 week ago

Question

Define the term Working Capital Gap.

Answered: 1 week ago