making points, rotating it, plotting.

1 view (last 30 days)
Rasmus
Rasmus on 25 Feb 2014
Commented: Rasmus on 26 Feb 2014
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 Comments
Rasmus
Rasmus on 25 Feb 2014
Edited: Rasmus on 25 Feb 2014
>> 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

Sign in to comment.

Answers (0)

Categories

Find more on Polar Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!