Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

SEMICONDUCTOR DEVICES

EE200

ASSIGNMENT 1
C code /*ASSIGNMENT 1 For T=100K, 200K, 300K, 400K, 500K, compute and plot Fermi function f(E). It is given that -0.5 eV (E-EF) 0.5 eV. */

#include<stdio.h> #include<math.h> #include<stdlib.h> int main(){ int counter; float k=0.00008617,j;//k is boltzman's constant float f1,f2,f3,f4,f5; float deltaE=-0.5; FILE *fp; fp=fopen("output.txt","w"); for(counter=0;counter<10000;counter++){ f1=1/(1+exp(deltaE/(k*100)));//f(E) at 100K f2=1/(1+exp(deltaE/(k*200)));//f(E) at 200K f3=1/(1+exp(deltaE/(k*300)));//f(E) at 300K f4=1/(1+exp(deltaE/(k*400)));//f(E) at 400K f5=1/(1+exp(deltaE/(k*500)));//f(E) at 500K fprintf(fp,"%f %f %f %f %f %f\n",deltaE,f1,f2,f4,f4,f5); deltaE=deltaE + 0.0001;//increasing E by 0.0001 }

fclose(fp); return(0); }

GNU PLOT COMMANDS set output "output.plt" set title "Fermi Function " set ylabel "f(E)" set xlabel "E-EF(ev)" set xrange[-0.5:0.5] plot "output.txt" using 1:2 title '100 K' with lines , "output.txt" using 1:3 title '200 K' with lines, "output.txt" using 1:4 title '300 K'with lines, "output.txt" using 1:5 title ' 400 K' with lines , "output.txt" using 1:6 title '500 K 'with lines // IT is important to take care of the directory in which you are working

You might also like