4.2 Whiteboard Coordinate System Error for Function
Afficher commentaires plus anciens
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?
Réponses (1)
Torsten
le 3 Mai 2024
Déplacé(e) : Steven Lord
le 3 Mai 2024
This arithmetic operation is not defined in MATLAB:
2\*pi
Catégories
En savoir plus sur Code Generation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!