Need help in Matlab. How do I modify this program to produce eye shapes like the pink picture using scaling, rotating and translating? Thank you! figure(1) x(1:2,1)=[1;0]; plot(x(1), x(2),'*'); grid on; hold on; axis([-15 15 -15 15]); k=1; Inc=1; for j=1:Inc:360; x(1:2,k+1)=[cosd(Inc) -sind(Inc);sind(Inc) cosd(Inc)]*x(1:2,k); plot(x(1,k+1), x(2,k+1),'^'); k=k+1; %for j=1:Inc:360; %x(1:2,k+1)=[cosd(Inc) -sind(Inc);sind(Inc) cosd(Inc)]*x(1:2,k); %plot(x(1,k+1), x(2,k+1),'^'); %k=k+1; %pause(); end for k=1:Inc:360; y1(1:2,k)=[1.5 0;0 3]*x(1:2,k); plot(y1(1,k),y1(2,k),'^') %for k=1:Inc:360; %y1(1:2,k)=[1.5 0;0 3]*x(1:2,k); %plot(y1(1,k),y1(2,k),'^') %pause(0.1); end for k=1:Inc:360; y2(1:2,k)=[3 0;0 1.5]*x(1:2,k)+[7;5]; plot(y2(1,k),y2(2,k),'^') %for k=1:Inc:360; %y2(1:2,k)=[3 0;0 1.5]*x(1:2,k)+[7;5]; %plot(y2(1,k),y2(2,k),'^') %pause(0.1); end for k=1:Inc:360; y3(1:2,k)=[3 0;0 1.5]*x(1:2,k)+[-7;5]; plot(y3(1,k),y3(2,k),'^') %for k=1:Inc:360; %y3(1:2,k)=[3 0;0 1.5]*x(1:2,k)+[-7;5]; %plot(y3(1,k),y3(2,k),'^') %pause(0.1); end for k=225:Inc:315 y4(1:2,k)=x(1:2,k)*5-[0;5]; plot(y4(1,k),y4(2,k),'^') %for k=45:Inc:135 %y4(1:2,k)=x(1:2,k)*5-[0;15]; %plot(y4(1,k),y4(2,k),'^') %pause(0.1); End
Need help in Matlab. How do I modify this program to produce eye shapes like the pink picture using scaling, rotating and translating? Thank you!
figure(1)
x(1:2,1)=[1;0];
plot(x(1), x(2),'*');
grid on; hold on;
axis([-15 15 -15 15]);
k=1;
Inc=1;
for j=1:Inc:360;
x(1:2,k+1)=[cosd(Inc) -sind(Inc);sind(Inc) cosd(Inc)]*x(1:2,k);
plot(x(1,k+1), x(2,k+1),'^');
k=k+1;
%for j=1:Inc:360;
%x(1:2,k+1)=[cosd(Inc) -sind(Inc);sind(Inc) cosd(Inc)]*x(1:2,k);
%plot(x(1,k+1), x(2,k+1),'^');
%k=k+1;
%pause();
end
for k=1:Inc:360;
y1(1:2,k)=[1.5 0;0 3]*x(1:2,k);
plot(y1(1,k),y1(2,k),'^')
%for k=1:Inc:360;
%y1(1:2,k)=[1.5 0;0 3]*x(1:2,k);
%plot(y1(1,k),y1(2,k),'^')
%pause(0.1);
end
for k=1:Inc:360;
y2(1:2,k)=[3 0;0 1.5]*x(1:2,k)+[7;5];
plot(y2(1,k),y2(2,k),'^')
%for k=1:Inc:360;
%y2(1:2,k)=[3 0;0 1.5]*x(1:2,k)+[7;5];
%plot(y2(1,k),y2(2,k),'^')
%pause(0.1);
end
for k=1:Inc:360;
y3(1:2,k)=[3 0;0 1.5]*x(1:2,k)+[-7;5];
plot(y3(1,k),y3(2,k),'^')
%for k=1:Inc:360;
%y3(1:2,k)=[3 0;0 1.5]*x(1:2,k)+[-7;5];
%plot(y3(1,k),y3(2,k),'^')
%pause(0.1);
end
for k=225:Inc:315
y4(1:2,k)=x(1:2,k)*5-[0;5];
plot(y4(1,k),y4(2,k),'^')
%for k=45:Inc:135
%y4(1:2,k)=x(1:2,k)*5-[0;15];
%plot(y4(1,k),y4(2,k),'^')
%pause(0.1);
End
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 5 images