Defining values into zeros matrix

조회 수: 2 (최근 30일)
Ilhami Alp Silahtaroglu
Ilhami Alp Silahtaroglu 2021년 1월 5일
댓글: Sriram Tadavarty 2021년 1월 5일
How can i define all s4 values in a FIRSTSPACE?
LOWERLIMIT = 1 ;
UPPERLIMIT = 360 ;
FIRSTSPACE=zeros(LOWERLIMIT,UPPERLIMIT);
for q=(0:1:360)
s4=[(0.096.*cos(q))-(0.168.*sin(q))]
end

채택된 답변

Sriram Tadavarty
Sriram Tadavarty 2021년 1월 5일
Hi,
You can directly execute
q= 0:1:360;
s4=[(0.096.*cos(q))-(0.168.*sin(q))]
Regards,
Sriram
  댓글 수: 3
Ilhami Alp Silahtaroglu
Ilhami Alp Silahtaroglu 2021년 1월 5일
@Sriram Tadavarty Thanks for your help, how can i write it in for loop for q=0:1:360
Sriram Tadavarty
Sriram Tadavarty 2021년 1월 5일
Using for loop is not apt here.
But, just in-case you only need it as such. Here is it:
LOWERLIMIT = 1 ;
UPPERLIMIT = 361 ;
FIRSTSPACE=zeros(LOWERLIMIT,UPPERLIMIT);
for q=(0:1:360)
FIRSTSPACE(q+1) = [(0.096.*cos(q))-(0.168.*sin(q))];
end
Regards,
Sriram

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by