Anda di halaman 1dari 25

# TUGAS 2 METODE FISIKA KOMPUTASI

## NAMA: FIA AMALIAH

NIM:60400114026
1. Praktikum 1
Program
:

Unit 2

%..................................................................
%Latihan Program_2.1a
%Program Pemakaian Fungsi Plot_3D
%Oleh: Muh. Said L
%..................................................................
clear all;
clc;
disp ('************************************************************');
disp ('
Latihan Program_2.1a
');
disp ('
Program Pemakaian Fungsi Plot 3D
');
disp ('************************************************************');
%
x y z
y=[-1 1 1;
2 0 1;
4 2 2;
3 3 3;
3 5 2;
1 1 1]
plot3(y(:,1),y(:,2),y(:,3),'or');
hold on
plot3(y(:,1),y(:,2),y(:,3),'-r');
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi Plot3D','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);
Hasil

## Visualisasi Grafik Melalui Fungsi Plot3D

koordinat-z

3
2.5
2
1.5
1
6
4
2

koordinat-y
2. Latihan 1 Unit 2
Program
:

-1

koordinat-x

%..................................................................
%Latihan Program_2.1b
%Program Pemakaian Fungsi Plot_3D
%Oleh: Muh. Said L
%..................................................................
clear all;
clc;
disp ('************************************************************');
disp ('
Latihan Program_2.1b
');
disp ('
Program Pemakaian Fungsi Plot 3D
');
disp ('************************************************************');
w=[0:pi/100:20*pi]
v=sin(w);
u=cos(w);
plot3(v,u,w,'*c')
hold on
plot3(v,u,w,'-y')
grid on
set(gca,'color',[0.6 0.2 0.6],'fontname','Arial');
title('Visualisasi Grafik Melalui Fungsi Plot3D','fontweight','bold','fontsize',14);
vlabel('koordinat-x','fontweight','bold','fontsize',14);
ulabel('koordinat-y','fontweight','bold','fontsize',14);
wlabel('koordinat-z','fontweight','bold','fontsize',14);
Hasil

## Visualisasi Grafik Melalui Fungsi Plot3D

80
60
40
20

0
1
0.5

1
0.5

-0.5

-0.5
-1

3. Praktikum 2
Program
:

-1

Unit 2

%..................................................................
%Latihan Program_2.2
%Program Pemakaian Fungsi Mesh
%Oleh: Muh. Said L
%..................................................................
clear all;
clc;
disp ('************************************************************');
disp ('
Latihan Program_2.2
');
disp ('
Program Pemakaian Fungsi Mesh
');
disp ('************************************************************');
%
x y z

y=[-1 1 1;
2 0 1;
4 2 2;
3 3 3;
3 5 2;
1 1 1]
mesh(y)
hold on
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi Mesh','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);
Hasil

## Visualisasi Grafik Melalui Fungsi Mesh

koordinat-z

4
3
2
1
0
-1
6
4
2

koordinat-y

1.5

2.5

koordinat-x

4. Latihan 2 Unit 2
Program
:

%..................................................................
%Latihan Praktikum_2.1
%Program Pemakaian Fungsi Mesh
%Oleh: Muh. Said L
%..................................................................
clear all;
clc;
disp ('************************************************************');
disp ('
Latihan Praktikum_2.1
');
disp ('
Program Pemakaian Fungsi Mesh
');
disp ('************************************************************');
a=[-5:0.5:5];
b=[0:0.5:10];
[a,b]=meshgrid(-5:0.5:5,0:0.5:10);
z=sin(a).*b+cos(a).*b+20
mesh(a,b,z)
hold on
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi Mesh','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);

ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);
Hasil

## Visualisasi Grafik Melalui Fungsi Mesh

35

koordinat-z

30
25
20
15
10
5
10
5
5

koordinat-y

0
0

-5

koordinat-x

5. Latihan 3 Unit 2
Program
:

%..................................................................
%Latihan Praktikum_2.2
%Program Pemakaian Fungsi Mesh
%Oleh: Muh. Said L
%..................................................................
clear all;
clc;
disp ('************************************************************');
disp ('
Latihan Praktikum_2.2
');
disp ('
Program Pemakaian Fungsi Mesh
');
disp ('************************************************************');
x=[-10:10];
y=[-10:10];
[x,y]=meshgrid(-10:10,-10:10);
z=(cos(sqrt((x.^2)+(y.^2))))/(sqrt((x.^2)+(y.^2)))
mesh(x,y,z)
hold on
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi Mesh','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);

Hasil

## Visualisasi Grafik Melalui Fungsi Mesh

13

x 10
1.5

koordinat-z

1
0.5
0
-0.5
-1
-1.5
10
5
0
-5

koordinat-y
6. Praktikum 3
Program
:

-10

-10

-5

10

koordinat-x

Unit 2

%..................................................................
%Latihan Program_2.3
%Program Pemakaian Fungsi Surf
%Oleh: Muh. Said L
%..................................................................
clear all;
clc;
disp ('************************************************************');
disp ('
Latihan Program_2.3
');
disp ('
Program Pemakaian Fungsi Surf
');
disp ('************************************************************');
%
x y z
y=[-1 1 1;
2 0 1;
4 2 2;
3 3 3;
3 5 2;
1 1 1]
surf(y)
hold on
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi Plot3D','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);

Hasil

## Visualisasi Grafik Melalui Fungsi Plot3D

koordinat-z

4
3
2
1
0
-1
6
4
2

koordinat-y

1.5

2.5

koordinat-x

7. Latihan 4 Unit 2
Program
:

%..................................................................
%Latihan Praktikum_2.4
%Program Pemakaian Fungsi surf
%Oleh: Fia Amalia
%..................................................................
clear all;
clc;
disp ('************************************************************');
disp ('
Latihan Praktikum_2.4
');
disp ('
Program Pemakaian Fungsi surf
');
disp ('************************************************************');
a=[-5:0.5:5];
b=[0:0.5:10];
[a,b]=meshgrid(-5:0.5:5,0:0.5:10);
z=sin(a).*b+cos(a).*b+20
surf(a,b,z);
hold on
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi Mesh','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);

Hasil

## Visualisasi Grafik Melalui Fungsi Mesh

35

koordinat-z

30
25
20
15
10
5
10
5
5

koordinat-y
8. Praktikum 4
Program
:

0
0

-5

koordinat-x

Unit 2

%..................................................................
%Latihan Program_2.4
%Program Pemakaian Fungsi Surfl
%Oleh: Muh. Said L
%..................................................................
clear all;
clc;
disp ('************************************************************');
disp ('
Latihan Program_2.4
');
disp ('
Program Pemakaian Fungsi Surfl
');
disp ('************************************************************');
%
x y z
y=[-1 1 1;
2 0 1;
4 2 2;
3 3 3;
3 5 2;
1 1 1]
surfl(y)
hold on
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi Plot3D','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);

Hasil

## Visualisasi Grafik Melalui Fungsi Plot3D

koordinat-z

4
3
2
1
0
-1
6
4
2

koordinat-y
9. Praktikum 5
Program
:

1.5

2.5

koordinat-x

Unit 2

%..................................................................
%Latihan Program_2.5
%Program Pemakaian Fungsi Pcolor
%Oleh: Muh. Said L
%..................................................................
clear all;
clc;
disp ('************************************************************');
disp ('
Latihan Program_2.5
');
disp ('
Program Pemakaian Fungsi Pcolor
');
disp ('************************************************************');
%
x y z
y=[-1 1 1;
2 0 1;
4 2 2;
3 3 3;
3 5 2;
1 1 1]
pcolor(y)
hold on
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi Plot3D','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);

Hasil

## Visualisasi Grafik Melalui Fungsi Plot3D

6
5.5
5

koordinat-y

4.5
4
3.5
3
2.5
2
1.5
1

10. Praktikum 6
Program
:

1.2

1.4

1.6

1.8

2.2

koordinat-x

2.4

2.6

2.8

Unit 2

%..................................................................
%Latihan Program_2.6
%Program Pemakaian Fungsi Imagesc
%Oleh: Muh. Said L
%..................................................................
clear all;
clc;
disp ('************************************************************');
disp ('
Latihan Program_2.6
');
disp ('
Program Pemakaian Fungsi Imagesc
');
disp ('************************************************************');
%
x y z
y=[-1 1 1;
2 0 1;
4 2 2;
3 3 3;
3 5 2;
1 1 1]
imagesc(y)
hold on
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi Plot3D','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);

Hasil

## Visualisasi Grafik Melalui Fungsi Plot3D

1

koordinat-y

6
0.5
11. Praktikum 7
Program
:

1.5

koordinat-x

2.5

3.5

Unit 2

%..................................................................
%Latihan Program_2.7
%Program Pemakaian Fungsi contour
%Oleh: Muh. Said L
%..................................................................
clear all;
clc;
disp ('************************************************************');
disp ('
Latihan Program_2.7
');
disp ('
Program Pemakaian Fungsi contour
');
disp ('************************************************************');
%
x y z
y=[-1 1 1;
2 0 1;
4 2 2;
3 3 3;
3 5 2;
1 1 1]
contour(y)
hold on
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi Plot3D','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);

Hasil

6
5.5
5

koordinat-y

4.5
4
3.5
3
2.5
2
1.5
1

1.2

1.4

1.6

1.8

2.2

koordinat-x

2.4

2.6

2.8

## 12. Tugas no.1 Unit 2

Program
:

%..................................................................
%Tugas Pemrograman Unit_2
%Program Pemakaian Fungsi switch_case dengan fungsi slice, fungsi quifer dan fungsi
waterfall
%Oleh: Fia Amalia
%..................................................................
clear all;
clc;
disp
('*************************************************************************************
*****');
disp ('
Tugas Pemrograman Unit_2_1
');
disp ('Program Pemakaian Fungsi switch_case dengan fungsi slice,fungsi quiferdan fungsi
waterfall');
disp
('*************************************************************************************
*****');
disp('Pilihan Fungsi Visualisasi 3D');
disp('1. Fungsi Slice');
disp('2. Fungsi Quiver');
disp('3. Fungsi waterfall');
disp(' ');
pilih=input('pilihan anda (1-3) -> ');
switch pilih
case 1
disp('Pemakaian Fungsi Slice');
disp('-------------------------');
x=input('elemen di koordinat x=');
y=input('elemen di koordinat y= ');
z=input('elemen di koordinat z= ');
[x,y,z]=meshgrid(-2:.2:2,-2:.25:2,-2:.16:2);
v=x.*exp(-x.^2-z.^2);
xslice=[-1.2,.8,2];
yslice=[2];
zslice=[-2,0];

slice(x,y,z,v,xslice,yslice,zslice)
colormap hsv
disp(['visualisasi grafik 3D fungsi slice='
num2str(slice(x,y,z,v,xslice,yslice,zslice))]);
case 2
disp('Pemakaian Fungsi Quiver');
disp('-------------------------');
x=input('elemen di koordinat x=');
y=input('elemen di koordinat y= ');
[xx,yy]=meshgrid(x,y);
zz=xx.*exp(-xx.^2-yy.^2);
quiver(x,y,px,py,2);
disp(['visualisasi grafik 3D fungsi quiver=' num2str(quiver(x,y,px,py,2))]);
case 3
disp('Pemakaian Fungsi waterfall');
disp('--------------------');
z=peaks(25);
waterfall(z)
colormap(jet)
axis ij
disp(['visualisasi grafik 3D fungsi waterfall=' num2str(waterfall(z))]);
otherwise
disp('pilihan anda ')
end;

Hasil
:
a. Fungsi Slice
Program:
******************************************************************************************
Tugas Pemrograman Unit_2_1
Program Pemakaian Fungsi switch_case dengan fungsi slice,fungsi quiferdan fungsi waterfall
******************************************************************************************
Pilihan Fungsi Visualisasi 3D
1. Fungsi Slice
2. Fungsi Quifer
3. Fungsi waterfall
pilihan anda (1-3) -> 1
Pemakaian Fungsi Slice
------------------------elemen di koordinat x=[-2:.2:2]
elemen di koordinat y= [-2:.25:2]
elemen di koordinat z= [-2:.16:2]

Hasil :

2
1
0
-1
-2
2
1
0
-1
-2

-2

-1

b. Fungsi Quiver
Program:
******************************************************************************************
Tugas Pemrograman Unit_2_1
Program Pemakaian Fungsi switch_case dengan fungsi slice,fungsi quiferdan fungsi waterfall
******************************************************************************************
Pilihan Fungsi Visualisasi 3D
1. Fungsi Slice
2. Fungsi Quifer
3. Fungsi waterfall
pilihan anda (1-3) -> 2
Pemakaian Fungsi Quiver
------------------------elemen di koordinat x=[-2:.2:2]
elemen di koordinat y= [-1:.2:1]
visualisasi grafik 3D fungsi quiver=172.0035

Hasil :

1.5

0.5

-0.5

-1

-1.5
-2.5

-2

-1.5

-1

-0.5

0.5

1.5

c. Fungsi Waterfall
Program:
******************************************************************************************
Tugas Pemrograman Unit_2_1
Program Pemakaian Fungsi switch_case dengan fungsi slice,fungsi quiferdan fungsi waterfall
******************************************************************************************
Pilihan Fungsi Visualisasi 3D
1. Fungsi Slice
2. Fungsi Quifer
3. Fungsi waterfall
pilihan anda (1-3) -> 3
Pemakaian Fungsi waterfall
-------------------visualisasi grafik 3D fungsi waterfall=172.0049
>>

Hasil :

10
5
0
-5
-10
30
20
10
0

10

15

20

25

## 13. Tugas no.2 Unit 2

Program
:

%..................................................................
%Tugas Pemrograman Unit_2
%Program Pemakaian Fungsi switch_case dengan fungsi slice, fungsi quifer dan fungsi
waterfall
%Oleh: Fia Amalia
%..................................................................
clear all;
clc;
disp
('*************************************************************************************
*****');
disp ('
Tugas Pemrograman Unit_2_2
');
disp ('Program Pemakaian Fungsi switch_case dengan fungsi slice,fungsi quiferdan fungsi
waterfall');
disp
('*************************************************************************************
*****');
disp('Pilihan Fungsi Visualisasi 3D');
disp('1. Fungsi Plot3D');
disp('2. Fungsi Mesh');
disp('3. Fungsi Surf');
disp('4. Fungsi Surfl');
disp('5. Fungsi Pcolor');
disp('6. Fungsi Imagesc');
disp('7. Fungsi Contour');
disp('8. Fungsi Contourf');
disp(' ');
pilih=input('pilihan anda (1-8) -> ');
switch pilih
case 1
disp('Pemakaian Fungsi Plot3D');
disp('-------------------------')
y=input('elemen-elemen matriks y= ');
plot3(y(:,1),y(:,2),y(:,3),'or');
hold on
plot3(y(:,1),y(:,2),y(:,3),'-r');

grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi
Plot3D','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);
disp(['visualisasi grafik 3D fungsi plot3D='
num2str(plot3(y(:,1),y(:,2),y(:,3)))]);
case 2
disp('Pemakaian Fungsi Mesh');
disp('-------------------------')
y=input('elemen-elemen matriks y= ');
mesh(y)
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi
Mesh','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);
disp(['visualisasi grafik 3D fungsi mesh=' num2str(mesh(y))]);
case 3
disp('Pemakaian Fungsi Surf');
disp('-------------------------')
y=input('elemen-elemen matriks y= ');
surf(y)
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi
Surf','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);
disp(['visualisasi grafik 3D fungsi surf=' num2str(surf(y))]);
case 4
disp('Pemakaian Fungsi Surfl');
disp('-------------------------')
y=input('elemen-elemen matriks y= ');
surfl(y)
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi
Surfl','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);
disp(['visualisasi grafik 3D fungsi surfl=' num2str(surfl(y))]);
case 5
disp('Pemakaian Fungsi Pcolor');
disp('-------------------------')
y=input('elemen-elemen matriks y= ');
pcolor(y)
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi
Pcolor','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);
disp(['visualisasi grafik 3D fungsi pcolor=' num2str(pcolor(y))]);
case 6
disp('Pemakaian Fungsi Imagesc');
disp('-------------------------')
y=input('elemen-elemen matriks y= ');
imagesc(y)
hold on

grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi
imagesc','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);
disp(['visualisasi grafik 3D fungsi imagesc=' num2str(imagesc(y))]);
case 7
disp('Pemakaian Fungsi Contour');
disp('-------------------------')
y=input('elemen-elemen matriks y= ');
contour(y)
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi
Contour','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);
disp(['visualisasi grafik 3D fungsi imagesc=' num2str(contour(y))]);
case 8
disp('Pemakaian Fungsi Contourf');
disp('-------------------------')
y=input('elemen-elemen matriks y= ');
contourf(y)
grid on
set(gca,'fontweight','bold','fontsize',10);
title('Visualisasi Grafik Melalui Fungsi
Contourf','fontweight','bold','fontsize',14);
xlabel('koordinat-x','fontweight','bold','fontsize',14);
ylabel('koordinat-y','fontweight','bold','fontsize',14);
zlabel('koordinat-z','fontweight','bold','fontsize',14);
disp(['visualisasi grafik 3D fungsi contourf=' num2str(contourf(y))]);
otherwise
disp('pilihan anda ')
end;
Hasil
:
a. Fungsi Plot3D
Program:
******************************************************************************************
Tugas Pemrograman Unit_2_2
Program Pemakaian Fungsi switch_case dengan fungsi slice,fungsi quiferdan fungsi waterfall
******************************************************************************************
Pilihan Fungsi Visualisasi 3D
1. Fungsi Plot3D
2. Fungsi Mesh
3. Fungsi Surf
4. Fungsi Surfl
5. Fungsi Pcolor
6. Fungsi Imagesc
7. Fungsi Contour
8. Fungsi Contourf
pilihan anda (1-8) -> 1
Pemakaian Fungsi Plot3D
------------------------elemen-elemen matriks y= [-1 1 1;2 0 1;4 2 2;3 3 3;3 5 2;1 1 1]
visualisasi grafik 3D fungsi plot3D=178.0038
>>
Hasil

## Visualisasi Grafik Melalui Fungsi Plot3D

koordinat-z

3
2.5
2
1.5
1
6
4
2

koordinat-y

-1

koordinat-x

b. Fungsi Mesh
Program:
******************************************************************************************
Tugas Pemrograman Unit_2_2
Program Pemakaian Fungsi switch_case dengan fungsi slice,fungsi quiferdan fungsi waterfall
******************************************************************************************
Pilihan Fungsi Visualisasi 3D
1. Fungsi Plot3D
2. Fungsi Mesh
3. Fungsi Surf
4. Fungsi Surfl
5. Fungsi Pcolor
6. Fungsi Imagesc
7. Fungsi Contour
8. Fungsi Contourf
pilihan anda (1-8) -> 2
Pemakaian Fungsi Mesh
------------------------elemen-elemen matriks y= [-1 1 1;2 0 1;4 2 2;3 3 3;3 5 2;1 1 1]
visualisasi grafik 3D fungsi mesh=172.0068
>>

Hasil :

5
4
3
2
1
0
-1
6
4
2
0

1.5

2.5

c. Fungsi Surf
Program:
******************************************************************************************
Tugas Pemrograman Unit_2_2
Program Pemakaian Fungsi switch_case dengan fungsi slice,fungsi quiferdan fungsi waterfall
******************************************************************************************
Pilihan Fungsi Visualisasi 3D
1. Fungsi Plot3D
2. Fungsi Mesh
3. Fungsi Surf
4. Fungsi Surfl
5. Fungsi Pcolor
6. Fungsi Imagesc
7. Fungsi Contour
8. Fungsi Contourf
pilihan anda (1-8) -> 3
Pemakaian Fungsi Surf
------------------------elemen-elemen matriks y= [-1 1 1;2 0 1;4 2 2;3 3 3;3 5 2;1 1 1]
visualisasi grafik 3D fungsi surf=172.0082
>>

Hasil :

5
4
3
2
1
0
-1
6
4
2
0

1.5

2.5

d. Fungsi Surfl
Program:
******************************************************************************************
Tugas Pemrograman Unit_2_2
Program Pemakaian Fungsi switch_case dengan fungsi slice,fungsi quiferdan fungsi waterfall
******************************************************************************************
Pilihan Fungsi Visualisasi 3D
1. Fungsi Plot3D
2. Fungsi Mesh
3. Fungsi Surf
4. Fungsi Surfl
5. Fungsi Pcolor
6. Fungsi Imagesc
7. Fungsi Contour
8. Fungsi Contourf
pilihan anda (1-8) -> 4
Pemakaian Fungsi Surfl
------------------------elemen-elemen matriks y= [-1 1 1;2 0 1;4 2 2;3 3 3;3 5 2;1 1 1]
visualisasi grafik 3D fungsi surfl=172.0095
>>

Hasil :

5
4
3
2
1
0
-1
6
4
2
0

1.5

2.5

e. Fungsi Pcolor
Program:
******************************************************************************************
Tugas Pemrograman Unit_2_2
Program Pemakaian Fungsi switch_case dengan fungsi slice,fungsi quiferdan fungsi waterfall
******************************************************************************************
Pilihan Fungsi Visualisasi 3D
1. Fungsi Plot3D
2. Fungsi Mesh
3. Fungsi Surf
4. Fungsi Surfl
5. Fungsi Pcolor
6. Fungsi Imagesc
7. Fungsi Contour
8. Fungsi Contourf
pilihan anda (1-8) -> 5
Pemakaian Fungsi Pcolor
------------------------elemen-elemen matriks y= [-1 1 1;2 0 1;4 2 2;3 3 3;3 5 2;1 1 1]
visualisasi grafik 3D fungsi pcolor=172.0109
>>

Hasil :

6
5.5
5
4.5
4
3.5
3
2.5
2
1.5
1

1.2

1.4

1.6

1.8

2.2

2.4

2.6

2.8

f. Fungsi Imagesc
Program:
******************************************************************************************
Tugas Pemrograman Unit_2_2
Program Pemakaian Fungsi switch_case dengan fungsi slice,fungsi quiferdan fungsi waterfall
******************************************************************************************
Pilihan Fungsi Visualisasi 3D
1. Fungsi Plot3D
2. Fungsi Mesh
3. Fungsi Surf
4. Fungsi Surfl
5. Fungsi Pcolor
6. Fungsi Imagesc
7. Fungsi Contour
8. Fungsi Contourf
pilihan anda (1-8) -> 6
Pemakaian Fungsi Imagesc
------------------------elemen-elemen matriks y= [-1 1 1;2 0 1;4 2 2;3 3 3;3 5 2;1 1 1]
visualisasi grafik 3D fungsi imagesc=177.011
>>

Hasil :

## Visualisasi Grafik Melalui Fungsi imagesc

1

koordinat-y

6
0.5

1.5

koordinat-x

2.5

3.5

g. Fungsi Contour
Program:
******************************************************************************************
Tugas Pemrograman Unit_2_2
Program Pemakaian Fungsi switch_case dengan fungsi slice,fungsi quiferdan fungsi waterfall
******************************************************************************************
Pilihan Fungsi Visualisasi 3D
1. Fungsi Plot3D
2. Fungsi Mesh
3. Fungsi Surf
4. Fungsi Surfl
5. Fungsi Pcolor
6. Fungsi Imagesc
7. Fungsi Contour
8. Fungsi Contourf
pilihan anda (1-8) -> 7
Pemakaian Fungsi Contour
------------------------elemen-elemen matriks y= [-1 1 1;2 0 1;4 2 2;3 3 3;3 5 2;1 1 1]

Hasil :

6
5.5
5
4.5
4
3.5
3
2.5
2
1.5
1

1.2

1.4

1.6

1.8

2.2

2.4

2.6

2.8

h. Fungsi Contourf
Program:
******************************************************************************************
Tugas Pemrograman Unit_2_2
Program Pemakaian Fungsi switch_case dengan fungsi slice,fungsi quiferdan fungsi waterfall
******************************************************************************************
Pilihan Fungsi Visualisasi 3D
1. Fungsi Plot3D
2. Fungsi Mesh
3. Fungsi Surf
4. Fungsi Surfl
5. Fungsi Pcolor
6. Fungsi Imagesc
7. Fungsi Contour
8. Fungsi Contourf
pilihan anda (1-8) -> 8
Pemakaian Fungsi Contourf
------------------------elemen-elemen matriks y= [-1 1 1;2 0 1;4 2 2;3 3 3;3 5 2;1 1 1]

Hasil :

6
5.5
5
4.5
4
3.5
3
2.5
2
1.5
1

1.2

1.4

1.6

1.8

2.2

2.4

2.6

2.8