making points, rotating it, plotting.

조회 수: 1 (최근 30일)
Rasmus
Rasmus 2014년 2월 25일
댓글: Rasmus 2014년 2월 26일
p1=[0;0] p2=[sqrt(3/4);-1/2] p3=[sqrt(3/4);1/2] p4=[0;1]
make a vector r from point p1 to p2:
r=p2-p1
construct a new vector s by rotating r 90 degree counterclockwise.
Make a new point: t2=p1+1/2*r+-1/6*sqrt(3/4)*s
repeat this between every point(p2 and p3, p3 and p4, and p4 and p1). connect these points as P1 with the 4 new points, plot it, and rotate it 120 degre two times. You should then have your final figure.
---------
I try to follow the assignment pretty strictly, but for some reason i dont get the same figure as my book has.
Anyone who can help me solving it?
  댓글 수: 3
Rasmus
Rasmus 2014년 2월 25일
편집: Rasmus 2014년 2월 25일
>> theta=90*pi/180;
>> R=[cos(theta) -sin(theta);sin(theta) cos(theta)]
>> r1=p2-p1; >> s1=R*r1; >> t1=p1+1/2*r1+-1/6*sqrt(3/4)*s1;
>> r2=p3-p2; >> s2=R*r2; >> t2=p1+1/2*r2+-1/6*sqrt(3/4)*s2;
>> r3=p4-p3; >> s3=R*r3; >> t3=p1+1/2*r3+-1/6*sqrt(3/4)*s3;
>> r4=p4-p1; >> s4=R*r4; >> t4=p1+1/2*r4+-1/6*sqrt(3/4)*s4;
>> P1=[t1 t2 t3 t4];
>> x1=P1(1,:);
>> y1=P1(2,:);
>> P1=[t1 t2 t3 t4];
>> fill(x1,y1,'r')
the black part is what i am supposed to get just from this, and by rotating it two times with 120 degree, i should get the two other fields.
the last here is mine
Rasmus
Rasmus 2014년 2월 26일
????

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by