Write a user-defined function for the following math function: y(x) = (-0.2x^3 +
ID: 3028405 • Letter: W
Question
Write a user-defined function for the following math function: y(x) = (-0.2x^3 + 7x^2)e^-0.3x The input should be x and the output y. Write such that x can be a vector. a. Use the function to calculate y(1.5) and y(5). b. Use the function to plot y(x) for -2 lessthanorequalto x lessthanorequalto 6 Write a user-defined function for the following math function: r(theta) = 4 cos(4 sin theta) The input should be theta (in radians) and the output is r. Use the function to calculate r(pi/6) and r(5 pi/6). Fuel consumption of airplanes is measured either in gallons per mile (gal/mi) or liters per kilometer (L/km). Write a user defined function that takes the input from g/mi to L/km. Name the function GmiToLkm, the input argument gmi and the output Lkm. Label the output using the disp command. a. Use the function to determine consumption of Boeing 747 whose fuel consumption is 5.0 gal/mi. b. Do the same for a Concorde whose is 5.8 gal/mi. Create an anonymous function for 10e^-2x and use it to plot the function over the range 0 greaterthanorequalto x greaterthanorequalto 2. Label each axis using the xlabel and ylabel commands. Create an anonymous function for 20x^2 - 200x + 3 and use it to a. Plot the function and use the grid command to determine approximate location of the minimum. b. Use fminbnd to precisely determine the location of the minimum. Create four anonymous functions to represent the function 6e^3cos x^2, which is composed of h(z) = 6e^z, g(y) = 3cos y, and f(x) = x^2. Use the anonymous function to plot 6e^3cos x^2 over the range 0 lessthanorequalto x lessthanorequalto 4Explanation / Answer
1)
a)
y=@(x)((-0.2).*(x.^3)+(7.*x.^2)).*(e^(-0.3.*x))
p1=y(1.5)
p2=y(5)
b)
fplot(@(x) y,[-2 6],'b')
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.