Question

In: Mechanical Engineering

Plot the function y = 10(1 = e-x/4) over the interval 0 ≤ x ≤ xmax, using a while loop to

Plot the function y = 10(1 = e-x/4) over the interval 0 ≤ x ≤ xmax, using a while loop to determine the value of xmax such that y(xmax) = 9.8.

Properly label the plot. The variable y represents force in newtons, and the variable x represents time in seconds.

Solutions

Expert Solution

= 0;

x_max = 0;

% infinite loop

while true

   

    % calculate y

    y = 10 *\r\n( 1 - exp(\r\n-/ 4 )\r\n);

   

    % is the current value of x is the required xmax

    if y >= 9.8

       

        x_max = x;

        break;

       

    end

   

    x = x + 0.01;

   

end

% create a vector x

=\r\n[ 0 : 0.01 : x_max ];

% create a vector y

= 10 .*\r\n( 1 - exp(\r\n-./ 4 )\r\n);

% set the title of the axis

title(\'Plot y = 10( 1 - exp(-x / 4) )\');

% set the label of the axis

xlabel(\'x\');

ylabel(\'y\');

grid on

hold

% plot the graph

plot( x , y );

 

Output:-


= 0;

x_max = 0;

% infinite loop

while true

Related Solutions

Use a for loop to plot the function given in Problem 16 over the interval -2 ≤ x ≤ 6. Properly label
Use a for loop to plot the function given in Problem 16 over the interval -2 ≤ x ≤ 6. Properly label the plot. The variable y represents height in kilometers, and the variable x represents time in seconds.
Find y as a function of x if y(4)−12y‴+36y″=−512e-2x y(0)=−1,  y′(0)=10,  y″(0)=28,  y‴(0)=16 y(x)=
Find y as a function of x if y(4)−12y‴+36y″=−512e-2x y(0)=−1,  y′(0)=10,  y″(0)=28,  y‴(0)=16 y(x)=
Solve the IVP using Laplace transforms x' + y'=e^t -x''+3x' +y =0 x(0)=0, x'(0)=1, y(0)=0
Solve the IVP using Laplace transforms x' + y'=e^t -x''+3x' +y =0 x(0)=0, x'(0)=1, y(0)=0
use a matlab built-in function to numerically solve: dy/dx= -x^2+((x^3*e^-y)/4) for 1<=x<=5 with y(1)=1 plot the...
use a matlab built-in function to numerically solve: dy/dx= -x^2+((x^3*e^-y)/4) for 1<=x<=5 with y(1)=1 plot the solution
What is the last value of variable x? y = 0 x = 0 while y<=10:...
What is the last value of variable x? y = 0 x = 0 while y<=10: if y%2==0: x = x + 2 y += 1
Solve the cauchy problem (x^2)*y''-9*x*y'+21*y=0, y'(1)=5 on the interval (1,3). Plot the graphs of y(x) and...
Solve the cauchy problem (x^2)*y''-9*x*y'+21*y=0, y'(1)=5 on the interval (1,3). Plot the graphs of y(x) and y'(x) Please Provide only MATLAB Code.
f(x,y)=30(1-y)^2*x*e^(-x/y). x>0. 0<y<1. a). show that f(y) the marginal density function of Y is a Beta...
f(x,y)=30(1-y)^2*x*e^(-x/y). x>0. 0<y<1. a). show that f(y) the marginal density function of Y is a Beta random variable with parameters alfa=3 and Beta=3. b). show that f(x|y) the conditional density function of X given Y=y is a Gamma random variable with parameters alfa=2 and beta=y. c). set up how would you find P(1<X<3|Y=.5). you do not have to do any calculations
Show that this function has a positive maximum on the interval 0<_x_<1: f(x)=x(x-1)e^x
Show that this function has a positive maximum on the interval 0<_x_<1: f(x)=x(x-1)e^x
For f(x,y)=cxy, ? ≥ 0, ? ≥ 0, ? + ? ≤ 1, Determine E(Y|x) and...
For f(x,y)=cxy, ? ≥ 0, ? ≥ 0, ? + ? ≤ 1, Determine E(Y|x) and E(X|y)
If X is uniformly distributed over (0, 1), find the fY (t) and E(Y ) of...
If X is uniformly distributed over (0, 1), find the fY (t) and E(Y ) of (a) Y = e X. (b)Y = − ln(X) (c) Y = cos(πX) (d)Y = sin(πX)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT