funcprot(0); mu0 = 1.2566370614e-6; Af = 1e-4; // ferrite lf = 15e-2; Nt = 300; f = 50; w = 2*%pi*f; C = 35e-6; //======================================================================= Bs = 0.38; //N30 Br = 0.175; Hc = 12; g = Bs/Br-1; Nl = Nt; lh = lf; function f = Bup ( H ) f = Bs * (H+Hc) / (abs(H+Hc)+Hc*g) + mu0*H; endfunction function f = Bdn ( H ) f = Bs * (H-Hc) / (abs(H-Hc)+Hc*g) + mu0*H; endfunction function f = Bmag ( H ) f = (Bup(H)+Bdn(H))/2; endfunction function f = H ( I ) I = abs(I); if(I < 0.001) then I = 0.001; end f = Nl * I / lh; endfunction function f = muf ( I ) f = Bmag(H(I))/(H(I)*mu0); endfunction //======================================================================= function f = L ( i ) Rf = lf / (mu0*muf(i)*Af); f = Nt*Nt / Rf; endfunction function f = Lu ( u ) x = linspace(0.001, 0.1, 1000); z = x(1000); for j=1:1000 if L( x(j) ) * x(j) * w >= u then z = x(j); break; end end f = L(z); endfunction //=============================================================================== Umin=0.01; Umax=3.1; N = 1000; udata = linspace ( Umin, Umax, N ); li_data = zeros(1,N); ci_data = zeros(1,N); i_data = zeros(1,N); for i=1:N li_data(i) = udata(i) / ( Lu( udata(i) ) * w ); ci_data(i) = udata(i) * C * w; i_data(i) = abs(ci_data(i) - li_data(i)); end clf(); subplot(111); a=get("current_axes"); a.grid=[1,1]; plot ( udata , li_data, "r"); plot ( udata , ci_data, "b"); plot ( udata , i_data, "g"); xtitle("i(u)"); //=======================================================================