F1G113078 Uas

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

UAS GEOKOMPUTASI

SOAL 2

data=xlsread ('Data_Pengukuran2.xlsx' ) ; % Membaca data dalam file .x3.n.x


x=data (:,1) ; % data variabel bebas
y=data (:,2) ; % data variabel terikat
% Menggunakan function [a0,a1] = regline_single_01 (x,y)[a0,a1] = regline_single_01
(x,y) ;
% Menggunakan function [a0,a1] = regline_single_02 (x,y)
[a0,a1] = regline_single_02(x,y) ;

% % Ploting grafik T Vs Z
% y_observed = y;
% y_caculated = a0+a1*x;
% % plot (x,y_observed, 'go') ; hold on
% % plot (x,y_calculated, 'r') ; hold on
% title ('Grafik T Vs Z hasil pengukuran dan perhitungan')
% ylabel ('Temperatur [C] ' )
% xlabel ('Kedalaman [m] ')

% Es= (sum((y_observed-y_caculated )./y_observed)) *100; % Dalam persen


% fprintf ('\nPersen Galat Relatif adalah :' );
% fprintf ('%0.3f',Es);
% fprintf ('persen \n' ) ;

% ploting grafik stress & strain


figure(1)
plot(x,y);
title('stress Vs strain')
xlabel('strain')
ylabel('stress')

% parameters a and b
fprintf('parameters a is %1.3d\n', a0)
fprintf('parameters b is %1.3d\n', a1)

% ploting stress resulted vs strain


y_caculated = a0+a1*x;
figure(2)
plot (x,y_caculated, 'r') ;
title ('Grafik stress calculated Vs strain')
ylabel ('stress' )
xlabel ('strain')
% Prediksi stress
fprintf ( ' \nPrediksi stress \n ' )
z =[0.125 0.375 0.75] ; T_estimate=a0+a1*z;
TZ= [z' T_estimate' ] ;
disp ( ' strain stress_estimate' )
disp (TZ)

% Prediksi Kedalaman (z)


% T=a0+a1*z ==>z= (T-a0 ) / a1 , dengan T=30 Celsius
% z_30= ( 30-a0 ) / a1 ;
% fprintf ( ' \nTemperatur 30 C terjadi pada kedalaman z= ' )
% fprintf ( ' % . 2f ' , z_30 )
% fprintf ( 'm\n' )
Persamaan Regresi Linier adalah y= -0.278+(8.146) *x

parameters a is -2.781e-01

parameters b is 8.146e+00

Prediksi stress

strain stress_estimate

0.1250 0.7401
0.3750 2.7766

0.7500 5.8313
stress Vs strain
4.5

3.5

2.5
stress

1.5

0.5

0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
strain
Grafik stress calculated Vs strain
4

3.5

2.5

2
stress

1.5

0.5

-0.5
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
strain

Data pengukuran

Strain Stress
0 0
0.05 0.252
0.1 0.531
0.15 0.84
0.2 1.184
0.25 1.558
0.3 1.975
0.35 2.444
0.4 2.943
0.45 3.5
0.5 4.115
Soal 4

% Program Regresi Linier Berganda (RH)


data=xlsread('Data_Pengukuran4.xlsx');
y=data(:,2); % The Observed RH
x1=data(:,3); % Td
x2=data(:,4); % Tw
En=length(y);
[bb_coef] = regline_multiple_01(x1,x2,y);
% Menampilkan Persamaan Regresi Linier Berganda
b0=bb_coef(1,1); % koefisien regresi b0 (konstanta)
b1=bb_coef(1,2); % koefisien x1
b2=bb_coef(1,3); % koefisien x2
fprintf('\nPersamaan Regresi Linier Berganda adalah y= ') ;
fprintf('%0.3f', b0) ;
fprintf('+(');fprintf('%.3f', b1);fprintf(')*x1\n') ;
fprintf('+(') ;fprintf('%.3f', b2);fprintf(')*x2\n \n') ;

% Menampilkan Koefisien Regresi


fprintf('koefisien regresi b0 (konstanta) adalah %1.3d\n', b0)
fprintf('koefisien regresi x1 adalah %1.3d\n', b1)
fprintf('koefisien regresi x2 adalah %1.3d\n', b2)

% Independent Variabel
disp('independent variabel')
disp(y)

% Plotting data
yc=b0+b1*x1+b2*x2;
figure (1)
plot3(x1,x2,y,'s');
title('independent variabel (observed data) Vs dependent variabel')
xlabel('x1 (1/S)')
ylabel('x2 (Grigid)')
zlabel('y (observed data)')
figure(2)
plot3(x1,x2,yc,'*r');
title('independent variabel (calculated data) Vs dependent variabel')
xlabel('x1 (1/S)')
ylabel('x2 (Grigid)')
zlabel('y (calculated data)')
Persamaan Regresi Linier Berganda adalah y= -6.036+(0.592)*x1

+(0.224)*x2

koefisien regresi b0 (konstanta) adalah -6.036e+00

koefisien regresi x1 adalah 5.918e-01

koefisien regresi x2 adalah 2.241e-01

independent variabel

14.4820

9.2450

14.9920

12.3200

14.3220

13.2640

11.8400

13.1940

12.1870

10.3300
9.9620

14.9660

10.6580

13.1170

12.5080

12.3420

10.9310
14.2160
9.2890

12.8310

10.3520

13.6580

13.3040

13.6010

13.8890

9.9100

13.5120

13.0890

14.5140

13.4200
no Por 1/s grd S
1 14.482 0.561167228 88.721 1.782
2 9.245 0.403551251 67.001 2.478
3 14.992 0.566251416 91.428 1.766
4 12.32 0.459981601 81.836 2.174
5 14.322 0.549450549 88.455 1.82
6 13.264 0.4952947 85.354 2.019
7 11.84 0.449438202 79.261 2.225
8 13.194 0.484966052 85.537 2.062
9 12.187 0.453720508 81.415 2.204
10 10.33 0.429553265 71.885 2.328
11 9.962 0.427350427 69.847 2.34
12 14.966 0.566251416 91.275 1.766
13 10.658 0.438596491 73.293 2.28
14 13.117 0.484966052 85.084 2.062
15 12.508 0.474833808 82.086 2.106
16 12.342 0.459981601 81.966 2.174
17 10.931 0.442869796 74.652 2.258
18 14.216 0.549450549 87.832 1.82
19 9.289 0.415973378 66.544 2.404
20 12.831 0.480307397 83.671 2.082
21 10.352 0.000429553 72.014 2,328
22 13.658 0.503271263 87.211 1.987
23 13.304 0.4952947 85.589 2.019
24 13.601 0.513874615 86.265 1.946
25 13.889 0.544365814 86.201 1.837
26 9.91 0.427350427 69.541 2.34
27 13.512 0.504795558 86.265 1.981
28 13.089 0.484966052 84.92 2.062
29 14.514 0.561167228 88.909 1.782
30 13.42 0.5 86 2

independent variabel (observed data) Vs dependent variabel

15

14
y (observed data)

13

12

11

10

9
100
90 0.8
80 0.6
0.4
70 0.2
x2 (Grigid) 60 0
x1 (1/S)
independent variabel (calculated data) Vs dependent variabel

15

14
y (calculated data)

13

12

11

10

9
100
90 0.8
80 0.6
0.4
70 0.2
x2 (Grigid) 60 0
x1 (1/S)
Problem 5
xx=[]; y=[];
d1=8; d2=7;
d3=0; d4=3;
d5=1; d6=1;
for i=1:2:11
xx=[xx i];
y1=(d1+d6)+(d2+d5)*i+(d3+d4)*i.^2;
y=[y y1];
end
yy=[xx' y'];
disp(' ==========')
disp(' x | y ')
disp(' ==========')
disp(yy)

==========
x | y
==========
1 20
3 60
5 124
7 212
9 324
11 460

>>

You might also like