Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

clear all r=1; x1=zeros(81,81); x2=zeros(81,81); x3=zeros(81,81); c=zeros(81,81)

ID: 3588455 • Letter: C

Question

clear all

r=1;

x1=zeros(81,81);

x2=zeros(81,81);

x3=zeros(81,81);

c=zeros(81,81);

x1new=zeros(81,81);

x2new=zeros(81,81);

x3new=zeros(81,81);

for i=1:1:81

theta=(i-1)*2*pi/80;

for j=1:1:81

phi=(j-1)*pi/80;

x1(i,j)=r*cos(theta)*sin(phi);

x2(i,j)=r*sin(theta)*sin(phi);

x3(i,j)=r*cos(phi);

hold on

end

end

surf(x1,x2,x3,'EdgeColor','c')

colormap winter

view (3)

A = [1 0 0; 0 1 0;0 0 1];

A = [1 2 0; 2 1 0;0 0 1];

A = [1 0 2; 0 1 0;2 0 1];

A = [1 0 0; 0 1 2;0 2 1];

A = [1 2 2; 2 1 2;2 2 1];

A = [1 0 0; 0 1 1;0 1 1];

A = [2 2 2; 2 2 2;2 2 2];

A = [2 2 2; 2 2 2;2 2 1];

A = [2.7 2 2; 2 2.7 2;2 2 1];

A = [2.7 2 2; 2 2.7 .2;.2 .2 1];

lambda=eig(A)

[V,D]=eig(A)

for i=1:1:81

theta=(i-1)*2*pi/80;

for j=1:1:81

phi=(j-1)*pi/80;

x1=r*cos(theta)*sin(phi);

x2=r*sin(theta)*sin(phi);

x3=r*cos(phi);

B=[x1;x2;x3];

X=A*B;

x1new(i,j)=X(1);

x2new(i,j)=X(2);

x3new(i,j)=X(3);

hold on

end

end

surf(x1new,x2new,x3new,'EdgeColor','none')

camlight('headlight')

axis equal

grid on

grid minor

title('Stretch Transform')

set(gca,'fontsize',12)

xlabel('x')

ylabel('y')

zlabel('z')

axis([-4 4 -4 4 -4 4])

hold off;

drawnow

F(j) = getframe;

end

Make a movie in MATLAB. There are 10 transforms. Make a movie that varies any entry in the transform matrix in a manner that causes the transform to "spin" about any single rotation axis (not necessarily x, y, or z)

Explanation / Answer

function spheremap

clear all

r=1;

x1=zeros(81,81);

x2=zeros(81,81);

x3=zeros(81,81);

c=zeros(81,81);

x1new=zeros(81,81);

x2new=zeros(81,81);

x3new=zeros(81,81);

for i=1:1:81

theta=(i-1)*2*pi/80;

for j=1:1:81

phi=(j-1)*pi/80;

x1(i,j)=r*cos(theta)*sin(phi);

x2(i,j)=r*sin(theta)*sin(phi);

x3(i,j)=r*cos(phi);

hold on

end

end

surf(x1,x2,x3,'EdgeColor','c')

colormap winter

view (3)

A = [1 0 0; 0 1 0;0 0 1];

A = [1 2 0; 2 1 0;0 0 1];

A = [1 0 2; 0 1 0;2 0 1];

A = [1 0 0; 0 1 2;0 2 1];

A = [1 2 2; 2 1 2;2 2 1];

A = [1 0 0; 0 1 1;0 1 1];

A = [2 2 2; 2 2 2;2 2 2];

A = [2 2 2; 2 2 2;2 2 1];

A = [2.7 2 2; 2 2.7 2;2 2 1];

A = [2.7 2 2; 2 2.7 .2;.2 .2 1];

lambda=eig(A)

[V,D]=eig(A)

for i=1:1:81

theta=(i-1)*2*pi/80;

for j=1:1:81

phi=(j-1)*pi/80;

x1=r*cos(theta)*sin(phi);

x2=r*sin(theta)*sin(phi);

x3=r*cos(phi);

B=[x1;x2;x3];

X=A*B;

x1new(i,j)=X(1);

x2new(i,j)=X(2);

x3new(i,j)=X(3);

hold on

end