How can I graph a cylindrical magnetic dipole?
2 views (last 30 days)
Show older comments
How can I graph a cylindrical magnetic dipole?
0 Comments
Answers (1)
chicken vector
on 26 Apr 2023
3 Comments
chicken vector
on 27 Apr 2023
Edited: chicken vector
on 27 Apr 2023
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')
See Also
Categories
Find more on Vector Fields in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!