clc
clear
abar=input('Masukkan tebakan awal= ');
mu=input('mu= ');
dt=input('dt= ');
ta=input('serta ta=');
a1(1)=abar;
a=1;
t=0:dt:ta;
n=length(t);
for i=1:(n-1)
   home
   k=i
   clc
   ab=a1(i);
   x(i)=exp(-a*t(i));
   x1(i)=exp(-ab*t(i));
   e(i)=x(i)-x1(i);
   a1(i+1)=a1(i)-mu*e(i);
end;
x(n)=exp(-a*t(n));
ab=a1(n);
x1(n)=exp(-ab*t(n));
e(n)=x(n)-x1(n);
subplot(411),plot(t,x),xlabel('t'),ylabel('x(t)'),grid;
subplot(412),plot(t,x1),xlabel('t'),ylabel('x^(t)'),grid;
subplot(413),plot(t,a1),xlabel('t'),ylabel('estimasi a'),grid;
subplot(414),plot(t,e),xlabel('t'),ylabel('e(t)'),grid;
