필터 지우기
필터 지우기

Error in figure (2)

조회 수: 3 (최근 30일)
Kundan Prasad
Kundan Prasad 2021년 8월 20일
R=10; %% radius of workpiece
f=0.5; %% feed rate in mm/min
s=50; %% spindle speed in rpm
N=100; %% no of points in one revoultions
a=f/(s*N);
Ax=2; %% amptitude in x-direction
Ay=2; %% amptitude in y-direction
lx=2.5; %% wavelenght in x-direction
ly=2.5; %% wavelenght in y-direction
n=((R*s*N)/f)+1; %% total number of points for given function
t=0.5; %% tool nose radius
Pi = (pi); %% storing the value of pi
for i=1:n
r(i)=(R-((i-1)*a)); %% calculation of radial distance
theta(i)= ((i-1)*(2*Pi/N)); %% calculation of theta
x(i)=(r(i)*cos(theta(i))); %% converting polar to cartesian for x
y(i)=(r(i)*sin(theta(i))); %% converting polar to cartesian for y
Z(i)=((Ax*cos(2*Pi*x(i)/lx))+(Ay*cos(2*Pi*y(i)/ly))); %% calcualtion of height for given function
end
figure(1)
T=delaunayTriangulation(x(:),y(:));
trisurf(T.ConnectivityList,x(:),y(:),Z(:),'EdgeColor','none','FaceAlpha',0.6);
view(-80,75) %% 3d surface plot
for j=1:n-1
u(j) = r(j);
p(j) = Z(j);
u(j+1) = r(j+1);
p(j+1) = Z(j+1);
m(j) =((p(j+1) - p(j))./(u(j+1)-u(j)));
newth(j+1) = atan(-m(j));
G(j)=r(j)-(t*sin(newth(j+1)));
J(j)=G(j).*cos(newth(j+1)); %% converting polar to cartesian for x
K(j)=G(j).*sin(newth(j+1)); %% converting polar to cartesian for y
H(j)= Z(j)+(t*cos(newth(j+1)))-t;
end
figure(2)
T=delaunayTriangulation(J(:),K(:));
trisurf(T.ConnectivityList,J(:),K(:),H(:),'EdgeColor','none','FaceAlpha',0.6);
view(-80,75)
For figure (1) , three part i.e. part-I-III equation has been used to plot. I am able to generate the figure (1) plot with given equation successfully. Part -IV equation shows the some modification of part-I and part-II equations and figure (2) plot should be according to this modification. Figure (2) should be somewhat similiar to figure (1), but i am getting totally different result. Can you please look into the code how it can be corrected??
Thank you

답변 (0개)

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by