How can fix index exceeds matrix error
古いコメントを表示
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 件のコメント
BAHADIR Karba
2019 年 1 月 30 日
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?
Luna
2019 年 1 月 30 日
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
2019 年 1 月 30 日
編集済み: BAHADIR Karba
2019 年 1 月 30 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!