Function: % (Root Finding With Rootsearch)
Function: % (Root Finding With Rootsearch)
Function: % (Root Finding With Rootsearch)
function y= fex41_3(x)
y = cosh(x)*cos(x) - 1;
root = brent(@fex41_3,4,5)
>> nomor3
root =
4.7300
2. function y=fex41_4(x)
y= cosh(x)*cos(x) - 1;
function y= dfex_4(x)
y= sinh(x)*sin(x);
root = newtonRaphson(@fex41_4,@dfex41_4,4,5)
>> nomor4
root =
4.7300
3. function y =fex41_11(x)
y= x*sin(x) + 3*cos(x) - x;
function y =dfex41_11(x)
y= x*cos(x) - 3*sin(x) - 1;
4. function y= fex41_12(x)
y= x*4 + 0.9*x^3 - 2.3*x^2 + 3.6*x - 25.2;
5. % Matlab
x = [2.36, 2.37, 2.38, 2.39];
y = [0.85866, 0.86289, 0.86710, 0.87129];
a = (-3*y(1)+4*y(2)-y(3))/(0.01*2);
b = (2*y(1)-5*y(2)+4*y(3)-y(4))/((0.01)^2);
f(2.26) = a
= 0.4240
f(2.36) = b
= -0.2000
% Manual
x 2.36 2.37 2.38 2.39
% Manual
x 0.95 1.00 1.05
% Manual
x 0.84 0.92 1.00 1.08 1.16
G(0.08) = (f(1.00)-2*f(1.00)+f(1.16))/(0.16^2)
= (f(0.431711)-2*f(0.367879)+f(0.313486))/(0.16^2)
= 0.3687
G(0.08) = (f(0.92)-2*f(1.00)+f(1.08))/(0.08^2)
= (f(0.398519)-2*f(0.367879)+f(0.339596))/(0.08^2)
= 0.3683
f(1.0)= (4*G(0.08)-G(0.16))/3
= (4*(0.3683)-G(0.3687))/3
= 0.3681
8. % Matlab
x = [0, 0.1, 0.2, 0.3, 0.4];
y = [0.000, 0.078348, 0.138910, 0.192916, 0.244981];
a = (-y(1)+y(5))/(2*0.2);
b = (-y(2)+y(4))/(2*0.1);
f = (4*b-a)/3
% f(0.2)= f
>> jawaban_no_8
f(0.2)= 0.5596
% Manual
x 0 0.1 0.2 0.3 0.4
G(0.2) = (-f(0)+f(0.4))/(0.2^2)
= (-(0.000)+(0.244981))/(2*0.2)
= 0.6125
G(0.1) = (-f(0.1)+f(0.3))/(0.1^2)
= (-(0.078348)+(0.192916))/(2*0.1)
= 0.5728
f(1.0)= (4*G(0.1)-G(0.2))/3
= (4*(0.5728)-G(0.6125))/3
= 0.5596
9. function y = fex_no_9(x)
y = log(1 + tan(x));
11.function y = fex_no_11(x)
y = x*5 + 3*x^3 - 2;
format long
[Integral,numEval] = romberg(@fex_no_11,0,2)
>> jawaban_no_11
Integral =
18
numEval =
5
12. x =[0, (pi/4), (pi/2), (3*pi/4), (pi)];
y =[1.0000 0.3431 0.2500 0.3431 1.0000];
I =(y(1)+4*y(2)+2*y(3)+4*y(4)+y(5))*((1/4)/3)
% Integral = I
>> jawaban_no_12
I =
0.4371
% Manual
x 0 /4 /2 3/4
= 0.4371