for m=1:2
rx=1+2*l*sin(m*b)*m
ry=1+2*l*cos(m*b)*m;
end
plot([1 rx 10],[1 ry 10]);
where l is given I need two value for rx and also for ry I mean that the result should be like this :
rx=0+2*l*sin(1*b)*1
ry=0+2*l*cos(1*b)*1;
rx=0+2*l*sin(2*b)*2
ry=0+2*l*cos(2*b)*2;

댓글 수: 2

John D'Errico
John D'Errico 2014년 6월 6일
Huh? Totally unclear as to what you are trying to do.
Image Analyst
Image Analyst 2014년 6월 6일
It's not clear if the first term should be 0, like after the loop, or 1, like you have it inside the loop. My answer below assumes 1.

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

 채택된 답변

Image Analyst
Image Analyst 2014년 6월 6일

1 개 추천

Get rid of the for loop. Just do this:
m=1:2
rx=1+2*l*sin(m*b)*m
ry=1+2*l*cos(m*b)*m;

댓글 수: 5

Mech
Mech 2014년 6월 6일
ok bro, just try it. it dosent work :(
Roger Stafford
Roger Stafford 2014년 6월 7일
편집: Roger Stafford 2014년 6월 7일
Image Analyst needs a 'dot':
m=1:2
rx=1+2*l*sin(m*b).*m;
ry=1+2*l*cos(m*b).*m;
plot([1 rx 10],[1 ry 10])
However, you should be able to figure that out, Mech.
Mech
Mech 2014년 6월 7일
thanks alot roger its work but what th meaning of dot in this place m is matrix, by adding dot what happen ?
Image Analyst
Image Analyst 2014년 6월 7일
It means element by element multiplication, instead of a matrix multiplication.
Mech
Mech 2014년 6월 7일
thank you Analyst ;)

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2014년 6월 6일

댓글:

2014년 6월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by