y|[gۑiUj𓚗z

 

1D

vO

yf_ex6_1.mz

function y=f_ex6_1(x)

% y=f_ex6_1(x)

y=-x^3+10*x^2+5*x+1;

> x1=fminbnd('f_ex6_1',-10,10)

x1 = -0.24127

> y1=f_ex6_1(x1)

y1 =  0.38981

܂

> [x1,y1]=fminbnd('f_ex6_1',-10,10)

x1 = -0.24127

y1 =  0.38981

 

 

2D

vO

yf_ex6_2.mz

function y=f_ex6_2(x)

% y=f_ex6_2(x)

y=exp(-2*abs(x)).*sin(10*x)-0.1;

yex6_2.mz

t=-5:0.01:5;

y=f_ex6_2(t);

n=length(y);

k=0;

z=[];

for i=1:n-1

    if y(i)*y(i+1)<0

        k=k+1;

        z(k)=fzero('f_ex6_2',[t(i),t(i+1)]);

    end

end

z

plot(t,y,z,f_ex6_2(z),'o')

grid('on')

legend('f_{2}(x)','zero')

> ex6_2

z =

   -1.129119

   -1.033603

   -0.594836

   -0.333780

    0.010224

    0.295984

    0.667280

    0.880396