% Define the parameters of the coilradius = 1; % radius of the coilheight = 2; % height of the coilturns = 6; % number of turnsnpoints = 100; % number of points to represent the coil% Create the coiltheta = linspace(0, turns*2*pi, npoints);
z = linspace(0, height, npoints);
[Theta, Z] = meshgrid(theta, z);
X = radius*sin(Theta);
Y = radius*cos(Theta);
% Plot the coil in 3Dfigure;
plot3(X(:), Y(:), Z(:), 'b', 'LineWidth', 2);
xlabel('X-axis');
ylabel('Y-axis');
zlabel('Z-axis');
title('3D Plot of a 6-turn Coil');
grid on;
axis equal;
view(45,30);