`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
FUNCTION FILE
function t=fun(v0,h)
g=9.81;
f=@(t) v0*t-0.5*g*t.^2-h;
t=fzero(f,10);
end
Command needed to run
fun(50,100)
b)
clear all
clc
x=input('Enter x: ');
if(x<-1)
y=exp(-x+1);
elseif(x<5)
y=2*sin(pi*x);
else
y=10*(x-5)+1;
end
fprintf('The value is %f\n',y);
Kindly revert for any queries
Thanks.
2. (a) An object thrown vertically with a speed vo reaches a height h at time...
2. (aj An object thrown vertically with a speed vo reaches a height h at time t,where with a user defined function that computes the time required to reach a Write a MATLAB program specified height h, for a given value of vo. The function's imput should be h, we and g Testverurtrott" for the case where h-100 m, vee50 m/s and g-9,82 /by free hand. Write the MATLAB you will run/call the function with these given values (b) Write...
10) you will run/call the function with these given values. (b) Write a flow chart and the script file using conditional statements with logical operator if/else and if/elseif, to evaluate the following function, assuming that the scalar x has a value: y 2 sin(m) for-1 x < 5 y=10(X-5) + 1 for x 25 Use your file to evaluate y for x5,x 3 and x 15 by hand 10) you will run/call the function with these given values. (b) Write...
matlab only Question 5: a.) Write an m-file using conditional statements to evaluate the following function, assuming that the scalar variable x has a value. The function is for x <-1 - 3e y=2+cos(m) for-1 x<5 y 10-5)+1 for r 2 5 Use your file to evaluate y for x5, x-3, and x-15, and Use keyboard entry for values of x. b.) Use a for loop in the above file to plot the above function over the interval -2x <10....
Height of an object (h) which is thrown vertically with the speed of V0 at each time (t) can be calculated by the following formula: In a scripts create an anonymous function to calculate h at each time t for the value of g=9.81 m/s2 and V0 = 65 m/s. Also plot the height versus time and use fzero to determine the time when the object hits the ground.
Question 2 We define, for a given integer m, 1 sism, h Xi = (i – 1) m-1' 1 X1 1 X2 The mx2 matrix X is defined as: X = 1 Xm [sin txi sin itx2 and the m X 1 vector Y is defined as: Y = 0.1 : [sin πm. = a) Create a function which for inputs m (a scalar) and v [v1; v2] (a column vector of 2x returns the scalar res given by res...
12. The height and speed of a projectile (such as a thrown ball) launched with a speed of \(v_{0}\) at an angle \(A\) to the horizontal are given by$$ \begin{array}{c} h(t)=v_{0} t \sin A-0.5 g t^{2} \\ v(t)=\sqrt{v_{0}^{2}-2 v_{0} g t \sin A+g^{2} t^{2}} \end{array} $$where \(g\) is the acceleration due to gravity. The projectile will strike the ground when \(h(t)=0\), which gives the time to hit \(t_{\text {hit }}=2\left(v_{0} / g\right) \sin A\). Suppose that \(A=30^{\circ}, v_{0}=40 \mathrm{~m} /...
When a ball falls from an initial height h, its speed s when it reaches the floor is given by the relation: s = squareroot 2 *h *g where g is the gravity constant 9.81 Immediately after hitting the floor, its speed becomes s1 = eps*s (where eps is a constant and s its speed before rebounding). The ball will then reach the height h1 = (s1)^2/(2*g) = (s*eps)/(2*g). After n rebounds, what is the equation of the height reached...
1. Analog Computing. Consider an object thrown straight upward with an initial vertical velocity vo from an initial height h(0) 0 We will use the circuit below to do an analog calculation of thc altitude as a function of time. vout (t) = klh(t) Vo is fixed at Vo = kovo, where vo is the initial upward velocity. All Rs are equal and all Cs are equal. Assume all capacitors are initially discharged. (a) Write an expression for the output...
Question 1: Creating a user-defined function Write a user-defined MATLAB function named PBTask4pl_f.m for the following math function with x the input argument and y the output y(x)=0.8x4-13x2-5x The function should work for x being a scalar or a vector. Write a script file named PBTask4pl.m to a) Use the function to calculate y(3) and y(5) and display the results in command window b) Use the function to make a plot of the function y(x) for -5:5: x 5:5. Label...