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?

 채택된 답변

darova
darova 2020년 3월 24일

1 개 추천

What about torus?
You can modify Z coordinate

댓글 수: 5

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)
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?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Surfaces, Volumes, and Polygons에 대해 자세히 알아보기

질문:

2020년 3월 24일

댓글:

2021년 11월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by