Currently I am trying to create a 3D surface model of a clutch plate in MatLab's mesh/surf environment.
I have the springs plotted via the plot3 command. Master springs are generated as follows:
%Spring Generation
NumberOfTurns= 15; % How many turns in each spring?
SpringLength=15; %How long is the spring in mm
SpringRadius=(CentralDiskThickness)/2; % Coil radius of each spring?
NumberOfSprings=4; %Number of springs in the clutch plate?
%Creation of master springs, first in x-direction, then in y-direction
t = 0:0.001:1; % each spring is 1001 points
Xs1=t; %x-coordinates (this sets the spring to be created in the x-direction)
Ys1=SpringRadius*cos(t*2*pi*NumberOfTurns); % y-coordinates
Zs1=SpringRadius*sin(t*2*pi*NumberOfTurns); % z-coordinates
Xs2=SpringRadius*sin(t*2*pi*NumberOfTurns) %x-coordinates
Ys2=t %y-coordinates (this sets the spring to be created in the y-direction)
Zs2=SpringRadius*cos(t*2*pi*NumberOfTurns) %z-coordinates
This code is based off Amitava Biswas' "Spring Demo" code.
The plotting of the springs is as follows:
for k=1:2 % each spring at a time
% log xyz coordinates of two end points for this spring
dX=x2(k)-x1(k); % extent of this spring along x-axis
dY=y2(k)-y1(k); % extent of this spring along y-axis
dZ=z2(k)-z1(k); % extent of this spring along z-axis
p=[Xs1'*dX,Ys1',Zs1'] % "Xs1*dX" stretches the spring in the x-direction to the correct length
sX=p(:,1)+x1(k); % shift x-coordinates
sY=p(:,2)+y1(k); % shift y-coordinates
sZ=p(:,3)+z1(k); % shift z-coordinates
plot3(sX,sY,sZ,'linewidth',2,'color', rand(1,3))
hold on % to add next spring
end
And another for loop is used for the y-direction springs
I want to plot this data as a mesh instead, so that I am able to create an overall mesh with both the springs and the rest of the clutch plate.
Any ideas?

 Akzeptierte Antwort

darova
darova am 24 Mär. 2020

1 Stimme

What about torus?
You can modify Z coordinate

5 Kommentare

Not sure if this is taboo, but do you mind showing the code you used for that mesh?
Sure, use meshgrid
R = 10;
r = 2;
t = linspace(0,2*pi,30);
p = linspace(0,2*pi*5,400);
[T,P] = meshgrid(t,p);
X = (R+r.*cos(T)).*cos(P);
Y = (R+r.*cos(T)).*sin(P);
Z = r*sin(T)+P;
surf(X,Y,Z)
darova
darova am 25 Mär. 2020
Remember that i just stratched torus in Z direction
Thank you very much :D
This is great, can you think of a way to compress/stretch the resulting spring?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Surfaces, Volumes, and Polygons finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by