So I have this assignment that ask me to write a function to translate this object
TR = triangulation(tet,X);
[FBtri,FBpoints] = freeBoundary(TR);
T = FBtri;
S = FBpoints' - [zeros(1,1079);zeros(1,1079);40*ones(1,1079)];
to show the object, use the code given by
axis([-120 120 -120 120 -120 120])
the first part of my assignment is "Write a function shift.m which takes as input a 3 × n matrix S (for example, as obtained from running setup.m), a scalar dist which gives the distance that the object should translate, and a string ’x’, ’y’, or ’z’ which tells which axis you want to translate along. "
My attempt is
n = size(S,2);
B = ones(1,n);
if axis == 'x'
S = S + [dist;0;0]*B;
elseif axis =='y'
S = S + [0;dist;0]*B;
S = S + [0;0;dist] * B;
However, this doesn't quite work because I got this error message when I was trying it out.
Error using shift
Too many output arguments.
So I'm just wondering where I did wrong and how I can fix it. Any help is greatly appreciated!
Thx in advance!