Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
Help with a robotic arm function

Subject: Help with a robotic arm function

From: Cory Lauer

Date: 3 Feb, 2013 22:39:07

Message: 1 of 1

I'm trying create a function that takes in 2 values of theta and 2 values of length and produces a graph showing the position of a 2DOF robotic arm. The code I currently have works except for the frame of reference.

function [] = armSim(theta1, theta2, a1, a2)

a0 = 5.64;
Y1 = a0;
Y2 = (a0 + (a1 * sind(theta1)));
Y3 = (Y2 + (a2 * sind(theta2)));
X1 = 0;
X2 = (0 + (a1 * cosd(theta1)));
X3 = (X2 + (a2 * cosd(theta2)));
line([-4 0], [0 0]);
hold on;
line([0 0], [0 a0]);
t = 0:0.1:2*pi;
x = cos(t)/15;
y = (sin(t)/15) + a0;
x = (cos(t)/15) + (0 + (a1 * cosd(theta1)));
y = (sin(t)/15) + (a0 + (a1 * sind(theta1)));
x = (cos(t)/15) + X3;
y = (sin(t)/15) + Y3;
hold off;

This produces a graph where 0 degrees is on the horizontal X-axis going right and 90 degrees is vertical y-axis going up. I need it to output on a graph that has 0 degrees vertical y-axis up, 90 degrees is x-axis right, and -90 degrees is x-axis left. How do I make it do that?

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us