clc
clear
abar=input('Masukkan tebakan awal= ');
dt=input('dt= ');
mu=input('mu = ');
ta=input('serta ta=');
a1(1)=abar;
a=1;
t=0:dt:ta;
n=length(t);
x(1)=sin(a*t(1));
x1(1)=sin(abar*t(1));
e(1)=abs(x(1))-abs(x1(1));
a1(2)=a1(1)+mu*e(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));
   e(i)=abs(x(i))-abs(x1(i));
 % error=abs(e(i));
 %  if le(error,0.0001)
 %    a1(i+1)=a1(i);
 %  else
      a1(i+1)=a1(i)+mu*e(i);
 %  end
end;
x(n)=sin(a*t(n));
ab=a1(n);
x1(n)=sin(ab*t(n));
e(n)=abs(x(1))-abs(x1(1));
plot(t,x);
pause
clf
plot(t,x1);
pause
clf
plot(t,e);
pause
clf
plot(t,a1);


