<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://www.convexoptimization.com/wikimization/skins/common/feed.css?97"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.convexoptimization.com/wikimization/index.php?action=history&amp;feed=atom&amp;title=Diode_Circuit_Analysis</id>
		<title>Diode Circuit Analysis - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.convexoptimization.com/wikimization/index.php?action=history&amp;feed=atom&amp;title=Diode_Circuit_Analysis"/>
		<link rel="alternate" type="text/html" href="http://www.convexoptimization.com/wikimization/index.php?title=Diode_Circuit_Analysis&amp;action=history"/>
		<updated>2026-04-24T15:00:35Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.11.0</generator>

	<entry>
		<id>http://www.convexoptimization.com/wikimization/index.php?title=Diode_Circuit_Analysis&amp;diff=3332&amp;oldid=prev</id>
		<title>Ranjelin at 23:28, 25 January 2025</title>
		<link rel="alternate" type="text/html" href="http://www.convexoptimization.com/wikimization/index.php?title=Diode_Circuit_Analysis&amp;diff=3332&amp;oldid=prev"/>
				<updated>2025-01-25T23:28:26Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 23:28, 25 January 2025&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Image:Diode.jpg|850px]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Image:Diode.jpg|850px]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Image:Cyclic.jpg|850px]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;function [vl Cdmax Cdmin Cdmed] = diodeMap(vi, Rs, Rl, verbose, fundfreq, Fs, precision)  %from Convex Optimization &amp;amp; Euclidean Distance Geometry&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;function [vl Cdmax Cdmin Cdmed] = diodeMap(vi, Rs, Rl, verbose, fundfreq, Fs, precision)  %from Convex Optimization &amp;amp; Euclidean Distance Geometry&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Ranjelin</name></author>	</entry>

	<entry>
		<id>http://www.convexoptimization.com/wikimization/index.php?title=Diode_Circuit_Analysis&amp;diff=3329&amp;oldid=prev</id>
		<title>Ranjelin at 06:33, 17 January 2025</title>
		<link rel="alternate" type="text/html" href="http://www.convexoptimization.com/wikimization/index.php?title=Diode_Circuit_Analysis&amp;diff=3329&amp;oldid=prev"/>
				<updated>2025-01-17T06:33:04Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 06:33, 17 January 2025&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;   isR = is*(Rs*Rl/(Rs + Rl) + Rd);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;   isR = is*(Rs*Rl/(Rs + Rl) + Rd);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;   % circuit.nb&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;   dvd = 1000*randn(size(vi));  %perturbation of derivative proves that iteration converges to same median capacitance&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;   dvd = 1000*randn(size(vi));  %perturbation of derivative proves that iteration converges to same median capacitance&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;   for i=1:5  %3 iterations will introduce randomness into mean impedance calculation&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;   for i=1:5  %3 iterations will introduce randomness into mean impedance calculation&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Ranjelin</name></author>	</entry>

	<entry>
		<id>http://www.convexoptimization.com/wikimization/index.php?title=Diode_Circuit_Analysis&amp;diff=3324&amp;oldid=prev</id>
		<title>Ranjelin: New page: 850px &lt;pre&gt; function [vl Cdmax Cdmin Cdmed] = diodeMap(vi, Rs, Rl, verbose, fundfreq, Fs, precision)  %from Convex Optimization &amp; Euclidean Distance Geometry    mp.Digi...</title>
		<link rel="alternate" type="text/html" href="http://www.convexoptimization.com/wikimization/index.php?title=Diode_Circuit_Analysis&amp;diff=3324&amp;oldid=prev"/>
				<updated>2025-01-16T23:51:32Z</updated>
		
		<summary type="html">&lt;p&gt;New page: &lt;a href=&quot;/wikimization/index.php/Image:Diode.jpg&quot; title=&quot;Image:Diode.jpg&quot;&gt;850px&lt;/a&gt; &amp;lt;pre&amp;gt; function [vl Cdmax Cdmin Cdmed] = diodeMap(vi, Rs, Rl, verbose, fundfreq, Fs, precision)  %from Convex Optimization &amp;amp; Euclidean Distance Geometry    mp.Digi...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Image:Diode.jpg|850px]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function [vl Cdmax Cdmin Cdmed] = diodeMap(vi, Rs, Rl, verbose, fundfreq, Fs, precision)  %from Convex Optimization &amp;amp; Euclidean Distance Geometry&lt;br /&gt;
   mp.Digits(precision);  %Advanpix MCT&lt;br /&gt;
   k   = 1.380649e-23;    %boltzmann constant  % https://www.nist.gov/si-redefinition/kelvin-boltzmann-constant&lt;br /&gt;
   T   = 298;             %temperature kelvin  %Neudeck p.5                &lt;br /&gt;
   q   = 1.602176634e-19; %electron charge     %NIST&lt;br /&gt;
   is  = 76.9e-12;        %circuitlab diodeInduced&lt;br /&gt;
   eta = 1.45;            %circuitlab diodeInduced&lt;br /&gt;
   tau = 4.32e-6;         %transport time. max exponent (observed) e-4. Increasing capacitance observes more nonlinearity in vL FFT.&lt;br /&gt;
   Rd  = 0.042;           %diode internal resistance&lt;br /&gt;
   nVt = eta*k*T/q;       %[V] thermal voltage for particular diode characterized by eta&lt;br /&gt;
   isR = is*(Rs*Rl/(Rs + Rl) + Rd);&lt;br /&gt;
&lt;br /&gt;
   % circuit.nb&lt;br /&gt;
   dvd = 1000*randn(size(vi));  %perturbation of derivative proves that iteration converges to same median capacitance&lt;br /&gt;
   for i=1:5  %3 iterations will introduce randomness into mean impedance calculation&lt;br /&gt;
      Lw = exp((isR + vi*Rl/(Rl + Rs))/nVt)*isR.*(1 + tau*dvd/nVt)/nVt;&lt;br /&gt;
      vd = isR - nVt*Lambert_W(Lw) + vi*Rl/(Rl + Rs);&lt;br /&gt;
      dvd = [vd(2)-vd(end); vd(3:end)-vd(1:end-2); vd(1)-vd(end-1)]/2;  %approximate the derivative first time around, otherwise dvd becomes near 0. Assumes periodicity.   &lt;br /&gt;
      if verbose&lt;br /&gt;
         Cd = tau*is*exp(vd/nVt)/nVt;&lt;br /&gt;
         Cdmed = median(Cd);&lt;br /&gt;
         disp([num2eng(Cdmed,false,false,false,16) ' farad']);&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
   if verbose&lt;br /&gt;
      Cdmax = max(Cd);&lt;br /&gt;
      Cdmin = min(Cd);&lt;br /&gt;
&lt;br /&gt;
      figure(20); plot(0:numel(Cd)-1, Cd);&lt;br /&gt;
      title('Cd over time'); xlabel('sample number'); ylabel('Farad'); set(get(gca,'ylabel'),'rotation',0);&lt;br /&gt;
      drawnow&lt;br /&gt;
   else&lt;br /&gt;
      Cd = tau*is*exp(vd/nVt)/nVt;&lt;br /&gt;
   end&lt;br /&gt;
   iC = Cd.*dvd*Fs;            %diffusion capacitor current. Normalization by Fs makes current independent of sample rate&lt;br /&gt;
   id = is*(exp(vd/nVt) - 1);  %ideal Shockley equation.  This is already independent of Fs.&lt;br /&gt;
   vl = (id + iC)*Rd + vd;&lt;br /&gt;
&lt;br /&gt;
   if verbose&lt;br /&gt;
      figure(21); plot(0:numel(iC)-1, iC);&lt;br /&gt;
      title('Cd current'); xlabel('sample number'); ylabel('Amp'); set(get(gca,'ylabel'),'rotation',0);&lt;br /&gt;
      figure(22); plot(0:numel(id)-1, id);&lt;br /&gt;
      title('diode current'); xlabel('sample number'); ylabel('Amp'); set(get(gca,'ylabel'),'rotation',0);&lt;br /&gt;
      idx = find(iC ~= 0);&lt;br /&gt;
      disp(['mean   capacitor  impedance  = ' num2str(orosumvec(vd(idx)./iC(idx),1)/numel(idx),'%3.4e')])&lt;br /&gt;
%       disp(['mean capacitor |impedance| = ' num2str(orosumvec(abs(vd(idx)./iC(idx)),1)/numel(idx),'%3.4e')])&lt;br /&gt;
      t = median(vd./iC);&lt;br /&gt;
      if t &amp;lt; 0, spc=[]; else spc=' '; end&lt;br /&gt;
      disp(['median capacitor  impedance  =' spc num2str(t)])  %median impedance is always far smaller than mean despite mp.Digits precision&lt;br /&gt;
      medcapimp = median(abs(vd./iC));  &lt;br /&gt;
      disp(['median capacitor |impedance| = ' num2str(medcapimp,'%3.4e')])&lt;br /&gt;
      disp(['empirical constant c = ' num2str(medcapimp*(2*pi*fundfreq*Cdmed),'%3.15e')])&lt;br /&gt;
&lt;br /&gt;
      figure(23);&lt;br /&gt;
      histogram(Cd,50,'Normalization','probability');                    %for book illustration&lt;br /&gt;
   %    histogram(Cd,round(3.25*48000));  %for counting smallest diffusion capacitors&lt;br /&gt;
      title('histogram C_d'); xlabel('bin'); ylabel('relative count'); %set(get(gca,'ylabel'),'rotation',0);&lt;br /&gt;
      drawnow&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
% https://www.mathworks.com/matlabcentral/fileexchange/43419-the-lambert-w-function&lt;br /&gt;
function w = Lambert_W(x,branch)&lt;br /&gt;
% Lambert_W  Functional inverse of x = w*exp(w).&lt;br /&gt;
% w = Lambert_W(x), same as Lambert_W(x,0)&lt;br /&gt;
% w = Lambert_W(x,0)  Primary or upper branch, W_0(x)&lt;br /&gt;
% w = Lambert_W(x,-1)  Lower branch, W_{-1}(x)&lt;br /&gt;
%&lt;br /&gt;
% See: http://blogs.mathworks.com/cleve/2013/09/02/the-lambert-w-function/&lt;br /&gt;
&lt;br /&gt;
   % Effective starting guess&lt;br /&gt;
   if nargin &amp;lt; 2 || branch ~= -1&lt;br /&gt;
      w = ones(size(x));     % Start above -1&lt;br /&gt;
   else  &lt;br /&gt;
      w = -2*ones(size(x));  % Start below -1&lt;br /&gt;
   end&lt;br /&gt;
   v = inf*w;&lt;br /&gt;
&lt;br /&gt;
   % Halley's method&lt;br /&gt;
   c = 0;&lt;br /&gt;
   limit = 100;&lt;br /&gt;
   while any(abs(w - v)./abs(w) &amp;gt; 1e-15) &amp;amp;&amp;amp; c &amp;lt; limit  %changed magic tolerance. Was 1e-8. -JonD&lt;br /&gt;
      v = w;&lt;br /&gt;
      e = exp(w);&lt;br /&gt;
      f = w.*e - x;  % Iterate, to make this quantity zero&lt;br /&gt;
      w = w - f./((e.*(w+1) - (w+2).*f./(2*w + 2)));&lt;br /&gt;
      c = c + 1;&lt;br /&gt;
   end&lt;br /&gt;
   if c &amp;gt;= limit&lt;br /&gt;
      disp('%%%%%%%%%%%%%%%%%%%%%% Warning: Lambert limit reached %%%%%%%%%%%%%%%%%%%%%')&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ranjelin</name></author>	</entry>

	</feed>