Multiple Summation of Series using For Loops (Magnetic Flux through Coil Simulation)
2 ビュー (過去 30 日間)
古いコメントを表示
Hello all,
I am trying to sum the following series for various positions, y being the position of the magnet in the function.
![Coupling Term2.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/246385/image.png)
The 'r' and 'z' values are known dimensions of a coil, indicating the thickness and height of the coil respectively. I have included the values in the table below. The plot that I get from this code is incorrect and I can't figure out why. Is my methodology for executing the series summation for each value of position (y) correct? Any help would be greatly appreciated.
clearvars
clc
close all
position = -0.09:0.001:0.09;
L = length(position);
Flux = zeros(1,L);
s = 0;
r = [0.00875 0.0125]; %inner and outer radius of coil (thickness)
z = [-0.015 0.015]; % z(2)-z(1) = height of coil (30 mm), centred at 0
Ac = (r(2) - r(1))*(z(2)-z(1)); %cross-sectional area of coil
Nc = 1500; % constants from table 1
Br = 1.31;
Vm = 5e-6;
Ff = 0.33;
for y = 1:L
for ii=1:2
for jj=1:2
x1 = (-1)^(ii+jj);
Zij = sqrt(r(ii)^2 + (z(jj) - position(y))^2);
x2 = log(r(ii)+Zij);
x3 = r(ii)/Zij;
s = s + x1*(x2 - x3);
end
end
s = s * 3*Nc*Br*Vm*Ff/(2*Ac);
Flux(y) = s/2.1079; %maximum flux should be 2.1079
s = 0;
end
y_h = position/0.03;
figure
plot(y_h,Flux)
xlabel('y / h')
ylabel('Flux / Maximum Flux')
![table of values.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/246386/image.png)
The correct plot should look like the one below.
![plot 2.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/246387/image.png)
0 件のコメント
採用された回答
Daniel M
2019 年 11 月 4 日
Hi Samuel, I don't see anything wrong with the code. The only thing I would change is to do the following outside the loops:
Flux = Flux./max(Flux);
This will normalize it to [-1,1] properly, since the actual max doesn't seem to be 2.1079.
As for the inflection point on your plot on both sides of the center (y/h =0), it is supposed to be there. It just isn't very clear in their plot. I'm sure if you found the 2nd derivative of the equation with respect to z, you would see clear inflection points analytically.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Particle & Nuclear Physics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!