Must be solved in Matlab. Please show screenshots of all code and comments so I
ID: 3713744 • Letter: M
Question
Must be solved in Matlab. Please show screenshots of all code and comments so I can learn.
Without defining a function in an m-script (think anonymous functions here!) and for the following function: f(x) 4x2-50x +5 a. Use the fplot function to plot the function between -10 and 10. Find the minimum of the function between -10 and 10. Give both the x-value and the function value at the minimum. Be sure you show the entire code for how you do this. b. c. Calculate the area under the curve from -10 to 10. Again, document your solution.Explanation / Answer
Solution:
code:
a)
function Y = calcFun(x)
Y = 4 * x^2 -50 * x + 5 ; % save it as calcFun.m
end
% now
% in command prompt type
fal = @calcFun
fplot(fal,[-10, 10])
b)
% to get minima
fminbnd(fal,-10,10)
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.