How can I plot the coordinates of my data by using for loop
Show older comments
prompt='input the module > Module = ';
m=input(prompt);
prompt='input the number of teeth > Teeth Number = ';
T=input(prompt);
prompt='input the pressure angle at pitch radius > Pressure Angle(deg) = ';
pre_ang=input(prompt);
prompt='input the addendum coefficient > a = ';
a=input(prompt);
% Evaluate the "Pitch Radius"
rp = (m*pi)/2;
% Evaluate the "Base Radius"
rb = rp*cos(degtorad(pre_ang));
% Evaluate the "Tip Radius"
rt = rp + a*m;
% Evaluate the "Circular Pitch Tooth Thickness"
cptt = (pi*m)/2;
% Evaluate the "Involute Angle at pitch point (theta)"
theta_pitch = tan(degtorad(pre_ang))- degtorad(pre_ang);
prompt= 'input the slice number on involute curve= ';
n_slice=input(prompt);
deltar = (rt-rb)/n_slice;
figure;
hold on;
for i = 1:n_slice
x = i*deltar;
R(i) = x+rb;
% Evaluate the pressure angle at Ri
theta(i) = acos(rb/R(i));
%Evaluate the involute angle at Ri
inv_ang(i)= tan(theta(i))-theta(i);
% Evaluate the Circular Tooth Thickness at Ri
ctt(i) = (2.*R(i))*((0.5*cptt/rp) + theta_pitch - inv_ang(i));
B = 0.5*ctt(i)/R(i);
%Eventually, Coordinates might be evaluated
X(i) = R(i)* sin(B);
Y(i) = R(i)* cos(B);
plot(X(i),Y(i),'r+')
end
% Is that right? I would use push.back by using C++, I am confused if it is need in here and please tell me how many ways of doing this, and the names. sincerely !
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!