4.2 Whiteboard Coordinate System Error for Function
I am currently going through the Arudino Matlab Engeering Kit, starting with the drawing Robot, and ran into a coding error message that I can not figure out. My code:
function xy = countsToXY(counts,Z_i,Base) % Define constants
countsPerRadian = countsPerRevolution/(2*pi);
r_spool = 0.0045; % Convert counts to angle
phi = counts/countsPerRadian; % Convert angle to change in string length
dStringLength = r_spool*phi; % Convert change in string length to change in Z
dZ = dStringLength/2; %Add change in Z to initial Z to get current Z
z = Z_i + dz; % Compute x and y from Z1 and Z2
x = (Base^2 + z(1)^2 – z(2)^2)/(2*Base);
y = sqrt(z(1)^2-x^2); xy = [x y];
end
But the error that I keep getting is:
Error: File: countsToXY.m Line: 2 Column: 46
Invalid use of operator.
Is there something that I’m missing or was not explained within the lesson that I need to run this code?I am currently going through the Arudino Matlab Engeering Kit, starting with the drawing Robot, and ran into a coding error message that I can not figure out. My code:
function xy = countsToXY(counts,Z_i,Base) % Define constants
countsPerRadian = countsPerRevolution/(2*pi);
r_spool = 0.0045; % Convert counts to angle
phi = counts/countsPerRadian; % Convert angle to change in string length
dStringLength = r_spool*phi; % Convert change in string length to change in Z
dZ = dStringLength/2; %Add change in Z to initial Z to get current Z
z = Z_i + dz; % Compute x and y from Z1 and Z2
x = (Base^2 + z(1)^2 – z(2)^2)/(2*Base);
y = sqrt(z(1)^2-x^2); xy = [x y];
end
But the error that I keep getting is:
Error: File: countsToXY.m Line: 2 Column: 46
Invalid use of operator.
Is there something that I’m missing or was not explained within the lesson that I need to run this code? I am currently going through the Arudino Matlab Engeering Kit, starting with the drawing Robot, and ran into a coding error message that I can not figure out. My code:
function xy = countsToXY(counts,Z_i,Base) % Define constants
countsPerRadian = countsPerRevolution/(2*pi);
r_spool = 0.0045; % Convert counts to angle
phi = counts/countsPerRadian; % Convert angle to change in string length
dStringLength = r_spool*phi; % Convert change in string length to change in Z
dZ = dStringLength/2; %Add change in Z to initial Z to get current Z
z = Z_i + dz; % Compute x and y from Z1 and Z2
x = (Base^2 + z(1)^2 – z(2)^2)/(2*Base);
y = sqrt(z(1)^2-x^2); xy = [x y];
end
But the error that I keep getting is:
Error: File: countsToXY.m Line: 2 Column: 46
Invalid use of operator.
Is there something that I’m missing or was not explained within the lesson that I need to run this code? arduino, code, matlab, drawing robot MATLAB Answers — New Questions