Script All
Script All
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Outputs from this function are returned to the command line.
function varargout = tugaswine_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
EX(1)=cawal;
IMP(1)=cawal;
for i = 2:waktu;
t(i)=i-1;
T = (t(i))-(t(i-1));
%rumus
EX(i)=(1-(T*konstanta))*EX(i-1);
IMP(i)=IMP(i-1)/(1+T*konstanta);
%tabel
myform = guidata (gcbo);
data(i,1)=t(i);
data(i,2)=EX(i);
data(i,3)=IMP(i);
end
plot (t,EX,'-.mo');
hold on;
plot (t,IMP,'-.rs');
hold on;
grid on
set(myform.uitable1,'data',data);
TUGAS 2
function varargout = pemodelanTitisSeaJasmine(varargin)
% PEMODELANTITISSEAJASMINE MATLAB code for pemodelanTitisSeaJasmine.fig
% PEMODELANTITISSEAJASMINE, by itself, creates a new
PEMODELANTITISSEAJASMINE or raises the existing
% singleton*.
%
% H = PEMODELANTITISSEAJASMINE returns the handle to a new
PEMODELANTITISSEAJASMINE or the handle to
% the existing singleton*.
%
% PEMODELANTITISSEAJASMINE('CALLBACK',hObject,eventData,handles,...)
calls the local
% function named CALLBACK in PEMODELANTITISSEAJASMINE.M with the given
input arguments.
%
% PEMODELANTITISSEAJASMINE('Property','Value',...) creates a new
PEMODELANTITISSEAJASMINE or raises the
% existing singleton*. Starting from the left, property value pairs
are
% applied to the GUI before pemodelanTitisSeaJasmine_OpeningFcn gets
called. An
% unrecognized property name or invalid value makes property
application
% stop. All inputs are passed to pemodelanTitisSeaJasmine_OpeningFcn
via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Outputs from this function are returned to the command line.
function varargout = pemodelanTitisSeaJasmine_OutputFcn(hObject, eventdata,
handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
hold off
finite(1)=koefisien;
explicit(1)=koefisien;
implicit(1)=koefisien;
hybrid(1)=koefisien;
analytical(1)=koefisien;
data(1,1)=0;
data(1,2)=finite(1);
data(1,3)=explicit(1);
data(1,4)=implicit(1);
data(1,5)=hybrid(1);
data(1,6)=analytical(1);
for w = 2:wkt;
t(w)=w-1;
deltaT = (t(w))-(t(w-1));
%rumus
finite(w)=((-konstanta)*(finite(w-1))*deltaT+(finite(w-1)));
explicit(w)=(1-(deltaT*konstanta))*explicit(w-1);
implicit(w)=implicit(w-1)/(1+deltaT*konstanta);
hybrid(w)=((explicit(w)*alfa)+((implicit(w))*(1-alfa)));
analytical(w)=((koefisien)*(exp((-konstanta)*(t(w)))));
%tabel
myform = guidata (gcbo);
data(w,1)=t(w);
data(w,2)=finite(w);
data(w,3)=explicit(w);
data(w,4)=implicit(w);
data(w,5)=hybrid(w);
data(w,6)=analytical(w);
end
plot (t,finite,'--go');
hold on;
plot (t,explicit,'-.cs');
hold on;
plot (t,implicit,'--mp');
hold on;
plot (t,hybrid,'-.r*');
hold on;
plot (t,analytical,'--b');
hold on;
legend('Finite' , 'Explicit' , 'Implicit', 'Hybrid', 'Analytical',
'Location', 'West');
grid on
set(myform.uitable1,'data',data);
TUGAS 3
rhosea=1025;
rhosea2=1026;
rho=1025.5;
g=9.81;
R=0.0025;
z0=-75;
ntot=1800;
wobj(1)=0;
zobj(1)=z0;
bf = -g*(rho-rhosea2)/rho;
for i=2:ntot;
t(i)=i-1;
dt=(t(i))-(t(i-1));
wobj(i) = (wobj(i-1)+dt*bf)/(1+R*dt);
zobj (i) = zobj(i-1)+((dt)*wobj(i-1));
end
plot(zobj,'m');
title('Lokasi Benda Terapung Sebagai Fungsi Waktu');
xlabel('Waktu(s)');
ylabel('Kedalaman(m)');
hold on
end
TUGAS 4
Ampl = 2.0; %amplitudo
gelombang
g = 9.81; %grafitasi
h = 5; %kedalaman
T = 10; %periode gelombang
c = (g*h)^(1/2); % fase kecepatan
lmd = T*c;
u0 = Ampl*((g/h)^(1/2)); %amplitudo U
xrange = 2*lmd;
x=[0:xrange/h:xrange];
t = 10;
trange = 2*T;
dt = trange/100;
ntot=trange/dt;
Agel = Ampl*sin(2*3.14*(x/lmd-t/T));
% rumus gelombang
u = u0*sin(2*3.14*(x/lmd-t/T));
%untuk menentukan U nya
ked = ((-u0/lmd))*(cos(((2*3.14)*x/lmd)-((2*3.14)*(t/T))));
%kedalaman gelombang
%plot grafik
plot(xpos1,-h+zpos1,'g--');
hold on;
plot(xpos2,-h+zpos2,'r--');
hold on;
plot(xpos3,-h+zpos3,'m--');
hold on;
plot(xpos4,-h+zpos4,'c--');
hold on;
plot(x,Agel,'b');
drawnow;
t = t+dt;
end