-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathcontraction_diode.m
More file actions
36 lines (29 loc) · 827 Bytes
/
contraction_diode.m
File metadata and controls
36 lines (29 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
%% GEORGE MICROS
%% ECE 313 ELECTRONICS
%% CONTRACTION FUNCTION FOR VOLTAGE ACROSS DIODE
clear; clc
% CIRCUIT CONDITIONS
Vdd = 5; %V
R = 1000; %Ohms
Vt = .0259; %V
%INITIAL CONDITIONS
I = .001; %A
Vdiode = .7; %V
Is = I*exp(-Vdiode/Vt);
Vdiode = zeros(10);
%INITAL GUESS VECTOR
guess = [10 -5 .2];
%ITERATION THROUGH GUESS VECTOR
for j = 1:length(guess)
Vdiode(1) = guess(j);
Idiode(1) = (Vdd - Vdiode(1))/R;
fprintf('\n\nInitial guess : Vdiode = %f V, ', Vdiode(1));
fprintf(' Idiode = %f A\n\n', Idiode(1));
for i = 2:10
%ITERATION USING CONTRACTION FUNCTION
Vdiode(i) = Vt * abs(log((Vdd-Vdiode(i-1))/(Is*R)));
fprintf('UPDATED: Vdiode = %f V', Vdiode(i))
Idiode(i) = (Vdd - Vdiode(i))/R;
fprintf('Initial guess : Idiode = %f A\n', Idiode(i));
end
end