Question: Lab 7 : User - defined function ( week 8 ) Question 1 The relationship between the traffic flow ( q ) in vehicle per

Lab 7: User-defined function (week 8)
Question 1
The relationship between the traffic flow (q) in vehicle per hour (vph) and the density (k) in vehicle per mile ( vpm ) is as following:
q=ak-bk2
Where; a=45.5 and b=-0.24
(a) Write a MATLAB function to calculate the traffic flow as a function of the density
(b) Plot the flow for the density from 0 until 189 vpm and determine maximum of the flow and also the density at maximum flow. Add axis labels (k, Density (vpm)) and (q, Flow (vph)) in addition to the title (Flow vs. Density).
Question 2
(1) define x
(2) call a function called "main" that takes the vector x input, and produce the following outputs:
Vector W defined by W(x)=-0.2x5+e-0.5x
Vector Z defined by Z(x)=x3+5x2
(3) plot Z vs W using red dotted line. Add appropriate x and y labels.
Question 3
The range of an object shot at an angle with respect to the x -axis and an initial velocity vo is given by: , range =v02(g)sin(2)
Where; vo=100ms;g=9.81ms2, and varies from 0 to 2 with 100 elements.
Create a MATLAB function (1 input) that returns:
(a) A Plot of the range distance vs. angle .
(b) The maximum range and the corresponding value.
Question 4
Create an anonymous function for 10e-2x and use it to plot the function over the range 0x2
Lab 7 : User - defined function ( week 8 )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!