else if inside for loop.
Mostrar comentarios más antiguos
Here,
u=-0.5:0.1:0.5
v= -1:0.1:1
r is a user inputed value. Could be +0.35 or -0.45 depending upon the probe position needed. If the inputed value of r is equal to or greater than 0.8, and if the round off value r1, is to be checked to find the nearest corresponding v(i) value,once this is found, if u(i) is equal to 0,the value of B is the value Bm2(i) corresponding to that v(i). Elseif u(i) is not equal to 0, the value of B is found using a compensation function but depending on the value of B corresponding to u(i)=0.
for i=1:numel(u)
Bxcf(i)= (((1.2566e-6 * I)/(4* pi * dxc(i))) * (1.8/(sqrt((dxc(i))^2+((1.8^2)/4)))));
for i=1:numel(u)
Bx1(i)= (((1.2566e-6 * I4(i))/(4* pi * dx1(i))) * (1.8/(sqrt((dx1(i))^2+((1.8^2)/4)))));
end
for i=1:numel(u)
Bx2(i)= (((1.2566e-6 * I5(i))/(4* pi * dx2(i))) * (1.8/(sqrt((dx2(i))^2+((1.8^2)/4)))));
end
for i=1:numel(u)
Bx3(i)= (((1.2566e-6 * I6(i))/(4* pi * dx3(i))) * (1.8/(sqrt((dx3(i))^2+((1.8^2)/4)))));
end
end
Bcx = abs(Bxcf-abs(Bx1)-abs(Bx2)-abs(Bx3));
p1 = -9.221e-08 ;
p2 = 9.08e-06 ;
p3 = -0.000331 ;
p4 = 0.002805 ;
p5 = 3.83 ;
p11 = -43.09;
p12 = 48.76;
p13 = -20.68;
p14 = 4.303;
count1 =round(numel(u)/2);
Bm1 = Bcx(count1);
r1 = round(r,1);
for i=1:numel(v)
y2(i) = abs(p1* abs(v(i)*100)^4 + p2* abs(v(i)*100)^3 + p3*abs(v(i)*100)^2 + p4*abs(v(i)*100) + p5)/3.83;
Bm2(i) = y2(i) * Bm1;
end
if abs(r1) >= 0.8
for i= 1:numel(u)
if abs(v(i)) == r1 && u(i)==0
y2(i) = abs(p1* abs(v(i)*100)^4 + p2* abs(v(i)*100)^3 + p3*abs(v(i)*100)^2 + p4*abs(v(i)*100) + p5)/3.83;
Bx(i)=y2(i) * Bm1;
elseif u(i) ~=0
y3 = abs((p11* abs(u(i))^3 + p12*abs(u(i))^2 + p13*abs(u(i)) + p14)/ (y2(i) * Bm1) *10^-6) ;
Bx(i) = abs(y3*10^-7);
end
elseif abs(r1) < 0.8
Bx(i)= Bcx;
end
end
1 comentario
Walter Roberson
el 11 de Feb. de 2020
What is the question?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Random Number Generation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!