Map matrix into colors

15 visualizaciones (últimos 30 días)
Jonas Aarup
Jonas Aarup el 25 de Oct. de 2018
Comentada: Jonas Aarup el 25 de Oct. de 2018
Some context: I am working on a 2-dimensional 2 link hydraulic actuated robot arm. I am able to calculate the natural frequency(wn) using the two variables xp1 and xp2 (piston position 1 and piston position 2 - my two actuators) for all positions of the pistons. This yields a 100x100 matrix where i sweep the pistons from 0 to 0.35 (minimum to maximum length) and i am able to plot a contour plot using xp1 and xp2 as my x and y axis.
I would like to make a contour-like-plot in the reachable domain of the arm. The following code shows how i calculate the x and y values of my end effector point using only piston positions as variables.
Xp1 = linspace(0,0.35,100);
Xp2 = linspace(0,0.35,100);
[xp1,xp2] = meshgrid(Xp1,Xp2);
x=xe.*cos((w1-v1+acos((lOQ.^2+lOH.^2-(x1_min+xp1).^2)./(2.*lOQ.*lOH)))+(2.*pi-w2+v2-acos((lBW.^2+lBG.^2-(x2_min+xp2).^2)./(2.*lBW.*lBG))))-ye.*sin((w1-v1+acos((lOQ.^2+lOH.^2-(x1_min+xp1).^2)./(2.*lOQ.*lOH)))+(2.*pi-w2+v2-acos((lBW.^2+lBG.^2-(x2_min+xp2).^2)./(2.*lBW.*lBG))))+lOB.*cos((w1-v1+acos((lOQ.^2+lOH.^2-(x1_min+xp1).^2)./(2.*lOQ.*lOH))));
y=ye.*cos((w1-v1+acos((lOQ.^2+lOH.^2-(x1_min+xp1).^2)./(2.*lOQ.*lOH)))+(2.*pi-w2+v2-acos((lBW.^2+lBG.^2-(x2_min+xp2).^2)./(2.*lBW.*lBG))))+xe.*sin((w1-v1+acos((lOQ.^2+lOH.^2-(x1_min+xp1).^2)./(2.*lOQ.*lOH)))+(2.*pi-w2+v2-acos((lBW.^2+lBG.^2-(x2_min+xp2).^2)./(2.*lBW.*lBG))))+lOB.*sin((w1-v1+acos((lOQ.^2+lOH.^2-(x1_min+xp1).^2)./(2.*lOQ.*lOH))));
Now what i am kindly asking is how to 'map' my values of my natural frequency onto the domain of the end effector of the robot arm something along the lines of a contour plot. What i have been able to figure out so far is basically only the relationship of wn(xp1,xp2), x(xp1,xp2), y(xp1,xp2) and since they depend on the same variable, it should somehow be able to string these together. The start of the first arm is at origo. I have attached some pictures. Kind regards.
  1 comentario
Jonas Aarup
Jonas Aarup el 25 de Oct. de 2018
Solved by making a 3D surf plot
surf(x,y,wn)
and rotating so the plot becomes a 2D plot.

Iniciar sesión para comentar.

Respuestas (0)

Productos


Versión

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by