Why should we write x(i,1)=cos(theta(1,i) in this format while using the for loop?

조회 수: 1(최근 30일)
I have a doubt regarding this way of represention.
for i=1:n+1
x(i,1)=R*cos(Theta_n(1,i)
Why cant we represent it as-
x(i)=R*cos(Theta_n(i))

채택된 답변

KSSV
KSSV 2021년 8월 17일
편집: KSSV 2021년 8월 17일
x = zeros(n+1,1) ;
for i=1:n+1
x(i)=R*cos(Theta_n(i)
You can very much write like you shown. But keep in mind that the variables should be vectors.
  댓글 수: 4

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by