How can I graph a cylindrical magnetic dipole?
2 次查看(过去 30 天)
显示 更早的评论
How can I graph a cylindrical magnetic dipole?
0 个评论
回答(1 个)
chicken vector
2023-4-26
3 个评论
chicken vector
2023-4-27
编辑:chicken vector
2023-4-27
r = 3;
n = 50;
scale = 5;
[X,Y,Z] = cylinder(r,n);
Z = Z*scale;
figure;
hold on;
surf(X,Y,Z,'FaceColor','r','EdgeColor','None');
fill3(X(2,:),Y(2,:),Z(2,:),'r');
surf(X,Y,Z-scale,'FaceColor','b','EdgeColor','None');
fill3(X(2,:),Y(2,:),Z(1,:) - scale,'b');
text(1.2*r*cos(pi/4),1.2*r*sin(pi/4),scale/2,'N','FontSize',32)
text(1.2*r*cos(pi/4),1.2*r*sin(pi/4),-scale/2,'S','FontSize',32)
hold off;
axis equal;
view([1 1 1])
set(gca,'XColor','None','YColor','None','ZColor','None','Color','None')
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Vector Fields 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!