clc
clear
abar=input('Masukkan tebakan awal= ');
fi=input('Sudut fasa berapa pi? ');
dt=input('dt= ');
K=input('K= ');
mu=input('mu= ');
ta=input('serta ta= ');
a1(1)=abar;
y(1)=0;
a=1;
ab=a1(1);
t=0:dt:ta;
n=length(t);
x(1)=sin(a*t(1));
x1(1)=sin(ab*t(1)+fi*pi);
e(1)=x(1)*x1(1);
y(2)=y(1)+K*e(1);
a1(2)=a1(1)+mu*y(1);
for i=2:(n-1)
   home
   k=i
   clc
   ab=a1(i);
   x(i)=sin(a*t(i));
   x1(i)=sin(ab*t(i)+fi*pi);
   e(i)=x(i)*x1(i);
   y(i+1)=y(i)+K*e(i);
	a1(i+1)=a1(i)+mu*y(i);
end;
x(n)=sin(a*t(n));
ab=a1(n)-mu*a1(n);
x1(n)=sin(ab*t(n)+fi*pi);
e(n)=x(n)*x1(n);
plot(t,x);
pause
clf
plot(t,x1);
pause
clf
plot(t,e);
pause
clf
plot(t,a1);
