Coding Matlab 3d Heart
Coding Matlab 3d Heart
%MEMBUAT GRAFIK 3D
clear
clc
disp('Nama :Bergas Samudera Perkasa')
disp('NRP :04111740000085')
disp('Hati 3D')
%MEMASUKKAN PERSAMAAN
%3D Heart
[y,x,z] = ndgrid(linspace(-2,2,100),linspace(-2,2,100),linspace(-2,2,100));
f = (x.^2+9/4*y.^2+z.^2-1).^3-x.^2.*z.^3-9/80*y.^2.*z.^3;
colormap hot
cla
isosurface(x,y,z,f,.0);
view(3);
camlight
axis on
text(0,0,-1.5,'ICE COLD','Color','blue','FontSize',20,'Rotation',+15)
%Arrow
hold on
quiversensorx = quiver3(-1.25,0.75,-0.75,2.25,-1.75,1.75);
step = 0.05;
[X,Y] = meshgrid(-1:0.25:1);
hold on
set(quiversensorx, 'Color', 'blue');
set(quiversensorx, 'LineWidth', 3);
HASIL
Nama :Bergas Samudera Perkasa
NRP :04111740000085
Hati 3D
>>
SCRIPT No. 2
Matriks X
X=
85
170
255
340
425
510
Matriks Y
Matrix_Y =
170
255
170
85
255
Y=a0+a1x+a2x.^2+a3x.^3+a4x.^4+a5x.^5
polyX =
1.0e+13 *
Matrix_Y =
170
255
170
85
255
invX =
c. Hitung Matrix A
A=
255.0000
-9.1500
0.1015
-0.0004
0.0000
-0.0000
Defenisikan fungsi Y
X2 =
127.5000
212.5000
297.5000
382.5000
467.5000
polyX2 =
1.0e+13 *
0.0000 0 0 0 0 0
Matrix_Y =
170
255
170
85
255
A2 =
-2.0286
0.0544
-0.0003
0.0000
-0.0000
Defenisikan fungsi Y
e.Plot Y dan Y2
didapatkan :
Y=(255.0000) +(-9.1500 x) +(0.1015 x^2) +(-0.0004 x^3) +(0.0000 x^4) +(-0.0000 x^5)
Y2=(0.0000) +(-2.0286 x) +(0.0544 x^2) +(-0.0003 x^3) +(0.0000 x^4) +(-0.0000 x^5)
>>