Hello ! I have a stupid question. When i run this function i see this error: "rototranslation" requires more input arguments to run. Why?
Show older comments
function [ F ] = rototranslation( x)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
% x1=beta
% x2=gamma
% x3=x
% x4=y
% x5=z
% x6=alpha
global b1f b2f b3f
global b1 b2 b3
R= [sin(x(1))*cos(x(2)) cos(x(6))*sin(x(2))-sin(x(6))*cos(x(1))*cos(x(2)) sin(x(6))*sin(x(2))-cos(x(6))*cos(x(1))*cos(x(2));
sin(x(1))*sin(x(2)) cos(x(6))*cos(x(2))-sin(x(2))*sin(x(6))*cos(x(1)) -sin(x(6))*cos(x(2))-cos(x(6))*cos(x(1))*sin(x(2));
cos(x(1)) sin(x(6))*sin(x(1)) cos(x(6))*sin(x(1))]
p=[x(3); x(4); x(5)];
b1s=R*b1f+p;
b2s=R*b2f+p;
b3s=R*b3f+p;
b4s=R*b3f+p;
F(1)=b1s(1)-b1(1);
F(2)=b1s(2)-b1(2);
F(3)=b1s(3)-b1(3);
F(4)=b2s(1)-b2(1);
F(5)=b2s(2)-b2(2);
F(6)=b2s(3)-b2(3);
F(7)=b3s(1)-b3(1);
F(8)=b3s(2)-b3(2);
F(9)=b3s(3)-b3(3);
end
Answers (2)
Geoff Hayes
on 10 Jan 2016
Alessandro - how are you calling this function? If you don't supply any input parameters and so call the function (from the Command Window) like
rototranslation
then you will observe the error
Error using rototranslation (line 14)
Not enough input arguments.
because I am not passing any input parameters.
Look at the function signature (the first line of the rototranslation.m)
function [ F ] = rototranslation( x)
There is a single input parameter named x which you must pass into this function. Examining the code, this input should be an array of six elements. For example,
x = randi(42,1,6);
F = rototranslation(x);
(Naturally, the global variables will have to be well defined though you may want to revisit the use of these globals.)
Star Strider
on 10 Jan 2016
You cannot run your function from the Command Line or a script just by typing its name. You have to provide an argument to it.
So to use it, you have to call it as:
x = [ ... SIX-ELEMENT VECTOR ... ];
F = rototranslation(x);
and if the function is written correctly, you will have your result in the ‘F’ variable.
Categories
Find more on Scope Variables and Generate Names in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!