필터 지우기
필터 지우기

how to loop it

조회 수: 1 (최근 30일)
Rizwana
Rizwana 2014년 1월 30일
댓글: Jos (10584) 2014년 1월 30일
I have two columns. Both columns reads 264 elements and lets call them x & y.
x= 264*1 % reads radius r
y =264*1 % reads angle theta
I want to multiply first element of x with 1st element of y & 2nt elemnt of x with 2nd elemnt of y. How to do it... I used this logic. Its not working... Please help me
for i = 1 :264
x_new = x(i) * cosd(y(i))
y_new = y(i) * sind(y(i))
end

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 1월 30일
편집: Azzi Abdelmalek 2014년 1월 30일
Use the multiplication element by element .*
z=x.*y
x_new=x.*cosd(y)
y_new=y.*sind(y)
  댓글 수: 1
Rizwana
Rizwana 2014년 1월 30일
Thank You. Iam getting it now :)

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

추가 답변 (1개)

Iain
Iain 2014년 1월 30일
Change:
x_new = x(i) * cosd(y(i))
y_new = y(i) * sind(y(i))
to
x(i+1) = x(i) * cosd(y(i))
y(i+1) = y(i) * sind(y(i))
  댓글 수: 1
Jos (10584)
Jos (10584) 2014년 1월 30일
?????

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

카테고리

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