![](/user_photo/_userpic.png)
Добавил:
SSU_CSIT
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Octave / zadan6_2
.m f = @(x)(x.^2 - log(x));
f1 = @(x)(x.^2 + log(x)-4);
m = [-3.5:0.002:0.5];
m2 = [-0.5:0.001:1];
subplot(1,2,1)
plot(m,f(m))
xlabel('x')
ylabel('y')
title('Variant 10')
grid on
subplot(1,2,2)
plot(m2,f1(m2))
xlabel('x')
ylabel('y')
title('Variant 20')
grid on
disp ('Метод бисекции')
z = bisection(f,13,15,0.002)
z2 = bisection(f1,-0.5,0.5,0.001)
disp('Метод хорд')
z = hord(f,13,15,0.002)
z2 = hord(f1,-0.5,0.5,0.001)
disp('Метод fzero')
%[X,FVAL,INFO,OUTPUT] = fzero(f,[13;15])
[X,FVAL,INFO,OUTPUT] = fzero(f1,[-0.5;0.5])
disp('Метод fsolve')
[X,FVAL,INFO,OUTPUT] = fsolve(f,[13;15])
[X,FVAL,INFO,OUTPUT] = fsolve(f1,[-0.5;0.5])
f1 = @(x)(x.^2 + log(x)-4);
m = [-3.5:0.002:0.5];
m2 = [-0.5:0.001:1];
subplot(1,2,1)
plot(m,f(m))
xlabel('x')
ylabel('y')
title('Variant 10')
grid on
subplot(1,2,2)
plot(m2,f1(m2))
xlabel('x')
ylabel('y')
title('Variant 20')
grid on
disp ('Метод бисекции')
z = bisection(f,13,15,0.002)
z2 = bisection(f1,-0.5,0.5,0.001)
disp('Метод хорд')
z = hord(f,13,15,0.002)
z2 = hord(f1,-0.5,0.5,0.001)
disp('Метод fzero')
%[X,FVAL,INFO,OUTPUT] = fzero(f,[13;15])
[X,FVAL,INFO,OUTPUT] = fzero(f1,[-0.5;0.5])
disp('Метод fsolve')
[X,FVAL,INFO,OUTPUT] = fsolve(f,[13;15])
[X,FVAL,INFO,OUTPUT] = fsolve(f1,[-0.5;0.5])