% otdr ideal
y=[85.36541 71.00386 59.05840 49.12265];
zi=(1/2)*(10*log10(y));
x=linspace(6,9,4);
ai=polyfit(x,zi,1),ateni=-ai(1)
%figure(1),plot(x,zi),xlabel('1 div=1km'),grid,title('ideal');

% otdr real fara zgomot termic
y=[85.36561 71.03828 59.01463 49.10767];
zr=(1/2)*(10*log10(y));
ar=polyfit(x,zr,1),atenr=-ar(1)
%figure(2),plot(x,zr),xlabel('1 div=1km'),grid,title('real fara');

% otdr real cu zgomot termic
y=[85.33952 71.01990 59.00444 49.08253];
zrz=(1/2)*(10*log10(y));
arz=polyfit(x,zrz,1),atenrz=-arz(1)
%figure(3),plot(x,zrz),xlabel('1 div=1km'),grid,title('real cu');

c=arz(1)*x+arz(2);figure(4),hold on,plot(x,c,'y'),plot(x,zrz,'r'),grid,hold off 