필터 지우기
필터 지우기

how to start with 0 (zero) in for loop?

조회 수: 38 (최근 30일)
Ender Rencuzogullari
Ender Rencuzogullari 2015년 11월 25일
댓글: Ender Rencuzogullari 2015년 11월 27일
for i = 1:n_slice
x(i) = i*deltar;
R(i) = x(i)+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',X(i),Y(i),'+b','LineWidth',2,'MarkerSize',3)
plot(-X(i),Y(i),'-r',-X(i),Y(i),'+b','LineWidth',2,'MarkerSize',3)
end
WHEN I START WITH 0 (ZERO) IT GIVES ERROR. BUT I NEED TO START WITH ZERO NOT 1 !!!
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 11월 25일

WHY DO YOU NEED TO START WITH ZERO NOT 1 !!!

Ender Rencuzogullari
Ender Rencuzogullari 2015년 11월 27일
my amateurship

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

채택된 답변

Thorsten
Thorsten 2015년 11월 25일
Use
for i = 1:n_slice+1
x(i) = (i-1)*deltar;
  댓글 수: 1
Ender Rencuzogullari
Ender Rencuzogullari 2015년 11월 25일
but I wonder why matlab does not allow to start from 0? and is there any different way to do it?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by