f(g(x)) implementation on matlab funcions. (function of functions??) code provided.
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
The following are a separate function files for Forward and Inverse Kinematics What I want is to do a f(g(x)) or viceversa on using this equations Like:
[x,y]= FoRobot(InvRobot(x,y))
I know this doesn't work. I am just putting this to make my question clear. With an input (x,y) to InvRobot, I need the out put of InvRobot, that is (y1, y2), to be the input of FoRobot, to give finally (x, y).
The following is my code for the functions.
%For Inverse
function [y1,y2]= InvRobot(x,y)
R=80;
xw=100;
y1=real(y-sqrt(R^2-x^2));
y2=y-R*cos(asin((xw-x)/R));
end
%Forward
function [x,y]= FoRobot(y1,y2)
R=80;
xw=100;
x=(sqrt(xw^2*(-4*y1^2+8*y1*y2-4*y2^2-4*xw^2)^2-4*(4*y1^2-8*y1*y2+4*y2^2+4*xw^2)*(y1^4-4*y1^3*y2+6*y1^2*y2^2-4*y1^2*R^2+2*y1^2*xw^2-4*y1*y2^3+8*y1*y2*R^2-4*y1*y2*xw^2+y2^4-4*y2^2*R^2+2*y2^2*xw^2+xw^4))-xw*(-4*y1^2+8*y1*y2-4*y2^2-4*xw^2))/(2*(4*y1^2-8*y1*y2+4*y2^2+4*xw^2));
y=y1+R*cos(asin(x/R));
end
The two functions work OK independently. Also if you can help me how to output only positive values from the functions.
The questions are therefore; 1. how to implement f(g(x)) or g(f(x)) 2. How to output positive values from the above function, example using only one of function is sufficient.
Thank you
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Assembly en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!