Figure 2

Matlab Script for Log-Log Plot of C-V Data for 1N4007 Diode

% Matlab script for analysis of capacitance as a function of 
% potential for a reverse biased diode

% changes directory and  loads data
chdir c:\data\ee222\lab4
load poo.asc;
potential = -poo(:,1);
capacitance = poo(:,2);

% converts capacitance from pF to F and then to 1/(C^2)
capacitance = capacitance .* (10^(-12));
capacitance = capacitance .^ 2
capacitance = 1 ./ capacitance

% fit a line to the data
c=polyfit(potential, capacitance,1)
y = potential.*c(1) + c(2);

% plot everything
plot(potential,capacitance,'ro', potential,capacitance,'b',potential,y, 'g');
ylabel ('1/(Capacitance)^2 (1/(F^2))');
xlabel ('Potential (V)');
title ('One Over Capacitance Squared versus Potential for 1N4007 Diode');
grid;


Back to body text