Write a function called eapprox that takes the value of k


Problem 1 The distance a freely falling object travels is

x = 1/2 gt2

where

g = acceleration due to gravity, 9.8 m/s2

t = time in seconds

x = distance traveled in meters.

If you have taken calculus, you know that we can find the velocity of the object by taking the derivative of the preceding equation. That is,

dx/dt = v = gt

We can find the acceleration by taking the derivative again:

dv/dt = a = g

a. Create a function called freefall with a single input vector t that returns values for distance x, velocity v, and acceleration g.

b. Write a script that tests your function with a time vector that ranges from 0 to 20 seconds.

Problem 2: Consider the following method to approximate the mathematical constant, e. Start by generating K uniform random integers between 1 and K. Compute J, the number of integers between 1 and K which were never generated. We then approximate e by the ratio

K/J

Consider the following example for K = 5. Assume that the following five integers are randomly generated between 1 and 5.

11232

The number of times the integers are generated is given by

698_Find the acceleration by taking the derivative.png

Write a function called eapprox that takes the value of K as input and which them approximates e using the method described above. Test your function several times with different values of K and compare the result to the value of e using the built-in MATLAB function.

Solution Preview :

Prepared by a verified Expert
MATLAB Programming: Write a function called eapprox that takes the value of k
Reference No:- TGS0779380

Now Priced at $40 (50% Discount)

Recommended (98%)

Rated (4.3/5)