# Konstanen aus konstanten.m laden
konstanten;
lambda = 10^(-9).*[546, 436, 405, 366];
U = [0.02, 0.6, 0.82, 1.14];
nu = c./lambda;
# ps output
gset term post enhanced;
gset output "photozelle.ps";
gset grid;
gset title "Photozelle";
gset xlabel "Frequenz {/Symbol n} [s^{-1}]";
gset ylabel "Spannung U [V]";
gset key left top;
xaxis=10^14.*[0,8.5];
axis([xaxis(1),xaxis(2),-2.5,1.5]);
printf("lineare Regression\n");
printf("numerisches Problem => 10^(-9)\n");
a=polyfit(10^(-9).*nu,10^(-9).*U,1);
a(2)=a(2)*10^9
y=a(2)+a(1).*xaxis;
printf("h mit h/e=a(1)\n");
abs(h_experiment=a(1)*e)
printf("Fehler\n");
abs(h_experiment-h)
printf("\\nu = 0, Austrittsarbeit\n");
w_a=y(1)*e
printf("\\nu bei 0 Volt ausgeben\n");
nu_0=-a(2)/a(1)
printf("\\lambda bei 0 Volt ausgeben\n");
lambda_0=c/nu_0
y_cs=-1.94+xaxis.*a(1);
printf("\\lambda_{min} Cs\n");
c/(1.94/a(1))
gset arrow from 4.5e+14,0.25 to 5.3e+14,0.03;
gset label "{/Symbol n}_0 = 5.44 10^{14} s^{-1},\
 {/Symbol l}_0 551.38 nm" at 1.8e+14,0.25;
# ergibt 3-seitiges PS-File (Schoenheitsfehler)
plot(nu,U,['@',';Messungen (K);'],\
 xaxis,y,['-',';lineare Regression;'],\
 xaxis,-1.94+xaxis.*a(1),[';(Cs);']);