' mw5lib.bas - jackord@kw.igs.net - revised 13 Mar 08 - Liberty Basic v4.02 ' transmitted amplitude versus (k[in]/k[out])^2 (negative for tunneling) ' the well/barrier width equals the incident wavelength ' Initialize Window nomainwin button#1, "Plot", [plot], UL, 10, 10, 50, 20 WindowWidth=518 ' pixel scale 0-500 WindowHeight=398 ' pixel scale 0-360 UpperLeftX=50: UpperLeftY=100 open "Transmitted Amplitude" for graphics_nsb as #1 #1 "trapclose [quit]" gosub [pin] [waitHere] wait [plot] gosub [pin] pi=4*atn(1) for i=-99 to 299 if i=0 then i=i+1 k=i*.01: a=2*k*pi if i<0 then c=(exp(0-a)+exp(a))/2: s=(exp(0-a)-exp(a))/2 x=0-k*k: t=1/(c*c+s*s*(k-1/k)^2/4)^.5 else c=cos(a): s=sin(a) x=k*k: t=1/(c*c+s*s*(k+1/k)^2/4)^.5 end if if i=-99 then #1 "place "; 128+int(40*x); " "; 312-int(300*t) else #1 "goto "; 128+int(40*x); " "; 312-int(300*t) end if next i goto [waitHere] [pin] #1 "cls": #1 "down": #1 "color black" #1 "place 88 12 ; box 488 312" #1 "place 85 332": #1 "\-1" #1 "place 485 332": #1 "\9" #1 "place 240 344": #1 "\(k[in]/k[out])^2" #1 "place 76 318": #1 "\0" #1 "place 76 18": #1 "\1" #1 "place 4 160": #1 "\Transmitted" #1 "place 8 180": #1 "\Amplitude" for i=1 to 9 #1 "line "; 88+40*i; " 12 "; 88+40*i; " 312" #1 "line 88 "; 12+30*i; " 488 "; 12+30*i next i #1 "color blue" return [quit] close #1 end