dipole helix strips in one figure

2 views (last 30 days)
Arun Bar
Arun Bar on 18 Dec 2022
Answered: VBBV on 24 Dec 2022
Hi,
I have following two questions:
1: Can I draw several helical (dipole helix) strips in one figure (not using the multifilar) using MATLAB R2022b version?
2: If yes, can I make them of different colors?
Many thanks!

Answers (1)

VBBV
VBBV on 24 Dec 2022
Do you mean like below ? Refer here
% Set the number of helixes to plot
N = 35;
% Set the radius and pitch of the helixes
radius = 1;
pitch = 0.2;
% Set the number of points to plot on each helix
num_points = 100;
% Initialize a matrix to hold the coordinates of the helixes
helix_coords = zeros(num_points, 3, N);
% Loop through each helix
for i = 1:N
% Set the phase offset for this helix
phase_offset = (i-1)*2*pi/N;
% Generate the x, y, and z coordinates for this helix
x = radius*cos((1:num_points)*2*pi/num_points + phase_offset);
y = radius*sin((1:num_points)*2*pi/num_points + phase_offset);
z = pitch*(1:num_points);
% Store the coordinates in the matrix
helix_coords(:,:,i) = [x', y', z'];
end
% Plot the helixes
plot3(squeeze(helix_coords(:,1,:)), squeeze(helix_coords(:,2,:)), squeeze(helix_coords(:,3,:)))

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!