clear all;
% Golubkov Andrej
% Test 21.Mai,2004

l{1}=545*10^(-9);	%gruen
l{2}=439*10^(-9);	%blau
n0=1.52;

leg{1}='mit grünem Filter';
leg{2}='mit blauem Filter';


dat{1}=load('kompensation_gruen.dat');
dat{2}=load('kompensation_blau.dat');


for i=1:2
	U{i} = dat{i}(:,1);
	phi{i} = dat{i}(:,2)/180*pi;
	dU{i} = dat{i}(:,3);
	
	%Kurvenfit
	X=[ones(size(U{i})),U{i}];
	k{i}=X\phi{i};
	%disp(k{i});

	uu{i}=[0:1:max(U{i})*1.1];


figure(i);clf;
hold on;
p1=plot(U{i},phi{i},'r.');
p2=herrorbar(U{i},phi{i},dU{i},'r.');
p3=plot(uu{i},k{i}(1)+uu{i}*k{i}(2));
hold off;


ax1=gca;
set(ax1,'XLim',[0,max(U{i})+200])
set(ax1,'YLim',[0,max(phi{i})*1.1])

le1=legend([p1,p3],leg{i},'linearer Fit',4);
xl1=xlabel('Spannung U / V');
yl1=ylabel('Intensität I');
%ti1=title('Ueberlagerte Lorentz- Profile');

grid on;

%auswertung
r63=2*k{i}(2)*l{i}/(2*pi*n0^3)



end





