Hello everyone,
I have problem about how to store value of Z_wire in a matrix form. Here is my code,
function [ inductance ] = inductance( N,w,h,d_in,s)u = pi*4*10.^-7;X= 2*10.^-7;r_in = d_in/2;p = w+s;k = w+h;%THE LENGHTH AND THE DISTANCE OF THE TRACKS FROM CENTER:
z(1:2,1) = [r_in r_in];z(1:2,2) = [d_in -r_in];z(1:2,3) = [d_in -r_in];z(1:2,4) = [r_in+p r_in];if N==1 z(1:2,5) = [r_in r_in+p];else z(1:2,5) = [d_in+p r_in+p];end for i = 6:1:4*N+1 z(1:2,i) = [z(1,i-4)+2*p z(2,i-4)+ sign(z(2,i-4))] ; if i==4*N+1 z(1:2,i) = [z(2,i-1) z(2,i-4)+ sign(z(2,i-4))] ; endendfor i = 1:1:4*N+1 Z_wire(1:3,i) = [z(1,i) w h];endfor i = 1:1:4*N+1 Z_wire = X*(log((2)*z(1,i)/0.22/k))- 1.25 + ((k/3*z(1,i))+ (u/4))endA = sum(Z_wire)end
i already run this code and got the value of Z_wire in the form of this Z_wire =
2.7500
Z_wire =
6.7500
Z_wire =
6.7500................
and the value of A is equal to the last value of Z_wire instead of it total value. Can anybody help me to correct my code?
Best Answer