Solution to Assume that the function y(x) = f (x) + g(x) has a single local minimum … - Sikademy
Author Image

Archangel Macsika

Assume that the function y(x) = f (x) + g(x) has a single local minimum in the interval 0 <= x <= 1, at x = xm. Write (i) a function M-file (called funct.m) and (ii) a MATLAB statement (using the fminbnd command) that together will compute xm and the value of y at xm.

The Answer to the Question
is below this banner.

Can't find a solution anywhere?

NEED A FAST ANSWER TO ANY QUESTION OR ASSIGNMENT?

Get the Answers Now!

You will get a detailed answer to your question or assignment in the shortest time possible.

Here's the Solution to this Question

i)

Matlab function code('func.m'):

function fun = func (x)

\mathrm{f}=@(\mathrm{x}) \mathrm{x}^3 ; g=@(x) 2^{*} x+1 ;

fun =f(x)-g(x);

end

ii) Main Program:

\mathrm{clc}

\mathrm{f}=@(\mathrm{x}) func (\mathrm{x}) ;

c=f z e r o(f,-1) ;

fprintf('The zero of the function is, c=% 4.2f \n', c);

Output:

Related Answers

Was this answer helpful?

Join our Community to stay in the know

Get updates for similar and other helpful Answers

Question ID: mtid-5-stid-8-sqid-349-qpid-236