mn=input('Modül Giriniz:');
T=input('Teeth Numbers :');
at=input('Transverse pressure angle: ');
ad=input('Addendum Coef: ');
de=input('Deddendum Coef :');
Hobtip=input('Hob Tip Radius coef: ');
rg=mn*T/2;
rr=rg-(de*mn);
br=rg*cosd(at);
tr=rg+(ad*mn);
b=(tr-br)/180;
r=br;
a=1;
r2=num2cell(br:b:tr);
inva=tand(at)-(at*pi/180);
ctt1=pi*mn/2;
% Involute Curves
while r<=tr
r=r+b;
a=a+1;
end
for i=1:1:a
teta{i}=acosd(br/r2{i});
invteta{i}=tand(teta{i})-(teta{i}*pi/180);
ctt2{i}=2*r2{i}*((0.5*ctt1/rg)+inva-invteta{i});
B{i}=0.5*ctt2{i}/r2{i};
x{i}=r2{i}*sin( B{i});
y{i}=r2{i}*cos(B{i});
leftx{i}=-1*r2{i}*sin(B{i});
end
% Trochoid Curves
B_tr=(de*mn)-(Hobtip*mn);
L=(pi*mn/4.0)-(B_tr*tand(at))-(Hobtip*mn/(cosd(at)));
W=((((pi*mn)/2.0)-L)/rg);
E=0;
e=E;
Emax=50*pi/180;
tro=Emax/179;
o=1;
E2=num2cell(0:tro:Emax);
while (e<=Emax)
e=e+tro;
o=o+1;
end
for q=1:o
Yz{q}=((rg-B_tr)*cos(E2{q}))+((rg*E2{q}*sin(E2{q})));
Xz{q}=(rg*E2{q}*cos(E2{q}))-((rg-B_tr)*sin(E2{q}));
DXZ{q}=(-(rg*E2{q}).*sin(E2{q}))+((B_tr*cos(E2{q})));
DYZ{q}=(B_tr*sin(E2{q}))+((rg*E2{q})*cos(E2{q}));
if(E==0)
A{q}=90*pi/180.;
end
A{q}=atan(DXZ{q}./DYZ{q});
Xt{q}=Xz{q}+((Hobtip*mn).*cos(A{q}));
Yt{q}=Yz{q}-(Hobtip*mn.*sin(A{q}));
Xtr{q}=Yt{q}.*sin(W)-Xt{q}.*cos(W);
Ytr{q}=Yt{q}.*cos(W)+Xt{q}.*sin(W);
leftXtr{q}=-1.*(Yt{q}.*sin(W)-Xt{q}.*cos(W));
end
% Tooth Curves
% Involute ones
plot(cell2mat(x),cell2mat(y));
hold on
plot(cell2mat(leftx),cell2mat(y));
hold on
% Trochoid Ones
plot(cell2mat(Xtr),cell2mat(Ytr));
hold on
plot(cell2mat(leftXtr),cell2mat(Ytr));

댓글 수: 4

index exceeds matrix dimensions "teta{i}=acosd(br/r2{i})
"yz{q}=((rg-b_tr)*cos(e2{q}))+((rg*e2{q}*sin(e2{q})))"
"xz{q}=(rg*e2{q}*cos(e2{q}))-((rg-b_tr)*sin(e2{q})) "
Rik
Rik 2019년 1월 30일
Have a read here (or here for more general advice). It will greatly improve your chances of getting an answer.
What have you tried to solve this problem yourself? Have you checked the dimensions of the arrays you're indexing when the error occurs?
Could you please define your inputs? So we can run your code?
mn=input('Modül Giriniz:');
T=input('Teeth Numbers :');
at=input('Transverse pressure angle: ');
ad=input('Addendum Coef: ');
de=input('Deddendum Coef :');
Hobtip=input('Hob Tip Radius coef: ');
BAHADIR Karba
BAHADIR Karba 2019년 1월 30일
편집: BAHADIR Karba 2019년 1월 30일
case 1 :
mn=3
T=20
at=20
ad=1.0
de=1.25
Hobtip=0.38
whenever i used any pertinent inputs programs give errors especially like that
indexing exceed,actually main problem due to double / cells
"teta{i}=acosd(br/r2{i})
"yz{q}=((rg-b_tr)*cos(e2{q}))+((rg*e2{q}*sin(e2{q})))"
"xz{q}=(rg*e2{q}*cos(e2{q}))-((rg-b_tr)*sin(e2{q})) "
Even i take an error like that sometimes,if ı rewrite plots on the command section can show plots correctly,But most of trying give errors and program stopped due to errors

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

 채택된 답변

Bob Thompson
Bob Thompson 2019년 1월 30일

1 개 추천

Your first error occurs with teta{i} = acosd(br/r2{i}); because r2 has one less element than the max values of i. I would suggest initializing a as 0 instead of 1.
I did not encounter the other errors.

댓글 수: 1

BAHADIR Karba
BAHADIR Karba 2019년 1월 30일
Yes,I forgot this a and o values must be started from 0;and also solved.
Many thanks ,
Best regards

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

질문:

2019년 1월 30일

댓글:

2019년 1월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by