%ME 362
%Lecture 2
%Photoelectric Effect

clc
clear all

%Speed of light [m/s]
c=299792458; 

%1 amu -> 1.66053873*10^-27 kg
km=1.66053873*10^-27;

%1 eV -> 1.60217646 × 10^-19 J
%1 J -> 1/(1.60217646 × 10^-19)=6.24150974 × 10^18 eV
ke=6.24150974*10^18;

%Mass of electron [kg]
melectron=9.10938188*10^-31;

%Plank's constant [m^2*kg/s=J*s]
h=6.626068*10^-34; 

%Work function [eV]
A=2;

echo on
%Case 1 (red) Figure 7 Lecture 2
%Photon Energy = h*nu

%lambda [m]
lambda1=700*10^-9
%nu [1/s]
nu1=c/lambda1
%Ep [eV]
Ephoton1=h*nu1*ke

%Ephoton < A => no electron emitted 

echo off

display('Press a key to continue ...')
pause
clc

echo on
%Case 2 (green) Figure 7 Lecture 2
%Photon Energy = h*nu

%lambda [m]
lambda2=550*10^-9
%nu [1/s]
nu2=c/lambda2
%Ep [eV]
Ephoton2=h*nu2*ke

%Ephoton > A => electron emitted with energy Ephoton-A

%Ee [eV]
Eelectron2=Ephoton2-A
%Ee [J]
Eelectron2=(Ephoton2-A)/ke
%ve [m/s]
velectron2=sqrt(2*Eelectron2/melectron)

echo off

display('Press a key to continue ...')
pause
clc

echo on
%Case 3 (blue) Figure 7 Lecture 2
%Photon Energy = h*nu

%lambda [m]
lambda3=400*10^-9
%nu [1/s]
nu3=c/lambda3
%Ep [eV]
Ephoton3=h*nu3*ke

%Ephoton > A => electron emitted with energy Ephoton-A

%Ee [eV]
Eelectron3=Ephoton3-A
%Ee [J]
Eelectron3=(Ephoton3-A)/ke
%ve [m/s]
velectron3=sqrt(2*Eelectron3/melectron)

echo off
