Beruflich Dokumente
Kultur Dokumente
diary ex9_1.dat
% Diode parameters
%This refers to an ordinary comment. % is used to input comments.
vt = 25.67e-3;
%Here we measured our values for I using a multimeter for example and juxtaposed it
with the corresponding values of the voltage ‘V’.
lni = log(i);
p_fit = polyfit(v,lni,1);
b = p_fit(2);
%generate the coefficients of the first degree polynomial best characterizing the data
set for ln(Io)
m = p_fit(1);
%generates the coefficients of the first degree polynomial best characterizing the data
set for 38.95597974/n
ifit = m*v + b;
%Combining the equation to get the actual polyfit.
% Calculate Is and n
Is = exp(b)
%Comparing,
%b = ln(Io) where Io is the saturation current Is.
%Therefore, exp(b) = Io = Is. This equivalent of the function exponential of the
function 'b'.
n = 1/(m*vt)
%Comparing,
% m = 1/nVt;
% Thus, cross multiplying,
% n = 1/mVt.
plot(v,ifit,'w', v, lni,'ow')
%This is the function for plotting. we are then plotting for the best fit in the points we
have obtained in the linear graph which would give us a straight line.
% plot(X,Y) creates a 2-D line plot of the data in Y versus the corresponding
values in X.
% If X and Y are both vectors, then they must have equal length. The plot
% If X and Y are both matrices, then they must have equal size. The plot
% plot(X1,Y1,...,Xn,Yn) plots multiple X, Y pairs using the same axes for all
lines.
plot(X1,Y1,X2,Y2,LineSpec2,X3,Y3).
ylabel('ln(i)')
%Labelling the Y-axis (ordinate) the term 'Ln (I)' representing the current which is in
the natural log form in other to enable us plot the graph reasonably.
The title of the graph of the experiment is 'Best fit linear model'.
diary
Is = 9.9525e-015
n = 1.5009