Home Forums Gamescan Chat42 About
* Login   * Register * FAQ    * Search
It is currently Sat 11-22-2025 6:43AM

All times are UTC - 6 hours




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: solving matrices in terms of variables with matlab
PostPosted: Mon 03-21-2005 11:42PM 
Offline
Major General

Joined: Sat 03-09-2002 12:57PM
Posts: 2026

Source: Sigma Nu
so i'm taking ME349 robotic manipulators this semester, and it involves a shitload of matrix multiplication. not like 3x3*3x1 or anything, i'm talking 6 4x4 matrices multiplied together, each with sine theta cosine theta a and d terms in them. i COULD do this in my TI89, but you can imagine how long it takes to type this shit out on a fucking calculator. i can't figure out how to get matlab to solve a matrix in terms of variables, i just get "d is not a defined variable" does anyone know if there is a way to get matlab to crank all these matricies out to get a 4x4 matrix with 902348 fucking terms in it? (because i know it will be that big, despite how many zeroes and ones are in it)


Top
 Profile  
    
 Post subject:
PostPosted: Tue 03-22-2005 12:24AM 
Offline
"para-dime"
User avatar

Joined: Tue 09-11-2001 2:34PM
Posts: 1084
Location: Off Campus (i.e. not hell)

Source: Off Campus
I really have no idea what you just said.

But Matlab <3's matrices. It's what it's built for. It will multiply the matrices no problem, so then you just get a 4X4 matrix. If you're looking to solve with row reductions, try the command rref (i think).

Ex:

You have matrices A, B, C, and D (all 4x4, or other such multipliable)
And you have an answer matrix which is 4 rows by 1 column of the desired answers.

E=A*B;
E=E*C;
E=E*D;
E=[E [ans_matrix]];
Ans=rref(E);

This will get you the values of the variables that will get you the answer matrix. Not sure if this is what you were looking for, but we'll see.

_________________
People with doctorate degrees get to be called Doctor. So yes, I guess I am your Master... bitch


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Tue 03-22-2005 1:27AM 
Offline
Major General

Joined: Sat 03-09-2002 12:57PM
Posts: 2026

Source: Sigma Nu
yeah, but that is for a matrix of say [1,2;3,4]. i'm looking for a matrix of [cos(t1),-sin(t1);a1,d1]*[-cos(t2),sin(t2);a2,0]=ANS, where ANS is in terms of t1, t2, a1, a2, and d1.


Top
 Profile  
    
 Post subject:
PostPosted: Tue 03-22-2005 3:19AM 
Offline
"para-dime"
User avatar

Joined: Tue 09-11-2001 2:34PM
Posts: 1084
Location: Off Campus (i.e. not hell)

Source: Off Campus
Ahhh, I got you now. But can't think of how to help you. Sorry, not sure how to make Matlab deal with uninitialized variables.

_________________
People with doctorate degrees get to be called Doctor. So yes, I guess I am your Master... bitch


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Tue 03-22-2005 8:15AM 
Offline
Sergeant

Joined: Sun 03-09-2003 9:34PM
Posts: 47

Source: Off Campus
Matlab can work with symbolic variables, but you need to declare them first:
<ul>syms a b c;
[a 2 sin(b)]*c</ul>

There are some handy commands to work with expressions
(simplify, subs, int (integrate), diff (differentiate), factor, expand, sym, etc.).

Mathworks has decent documentation on-line (and as a PDF):
<ul>http://www.mathworks.com/access/helpdesk/help/toolbox/symbolic/</ul>

Or you can get the basics from Matlab's on-line help
(I.e. "help simple", "help syms", ...).

Bill


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Tue 03-22-2005 10:32AM 
Offline
Captain
User avatar

Joined: Tue 02-24-2004 10:30PM
Posts: 150

Source: TJ South
>> syms t1 a1 d1 t2 a2
>> [cos(t1),-sin(t1);a1,d1]*[-cos(t2),sin(t2);a2,0]

ans =

[ -cos(t1)*cos(t2)-sin(t1)*a2, cos(t1)*sin(t2);
-a1*cos(t2)+d1*a2, a1*sin(t2)]


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Tue 03-22-2005 2:08PM 
Offline
Major General

Joined: Sat 03-09-2002 12:57PM
Posts: 2026

Source: Sigma Nu
BAM! thanks guys. i had tried using "global variables" but they were being defined as 1x1 matrices of empty value, causing a vert_cat error. i had searched help for "variables" but hadn't found any of this symbolic shit. i'm definatl going to give it a try though!

its just too bad that my syms are going to be th1-6, a1-6 and d2-5


Top
 Profile  
    
 Post subject:
PostPosted: Tue 03-22-2005 2:29PM 
Offline
Major General

Joined: Sat 03-09-2002 12:57PM
Posts: 2026

Source: Sigma Nu
HAHAHAHHAHAHAHAHAHAH

what was tha command for simplifying, again?

Quote:
>> T60=A1*A2*A3*A4*A5*A6

T60 =

[ (((cos(t1)*cos(t2)*cos(t3)-cos(t1)*sin(t2)*sin(t3))*cos(t4)-sin(t1)*sin(t4))*cos(t5)+(cos(t1)*cos(t2)*sin(t3)-cos(t1)*sin(t2)*cos(t3))*sin(t5))*cos(t6)+(-(cos(t1)*cos(t2)*cos(t3)-cos(t1)*sin(t2)*sin(t3))*sin(t4)-sin(t1)*cos(t4))*sin(t6), -(((cos(t1)*cos(t2)*cos(t3)-cos(t1)*sin(t2)*sin(t3))*cos(t4)-sin(t1)*sin(t4))*cos(t5)+(cos(t1)*cos(t2)*sin(t3)-cos(t1)*sin(t2)*cos(t3))*sin(t5))*sin(t6)+(-(cos(t1)*cos(t2)*cos(t3)-cos(t1)*sin(t2)*sin(t3))*sin(t4)-sin(t1)*cos(t4))*cos(t6), -((cos(t1)*cos(t2)*cos(t3)-cos(t1)*sin(t2)*sin(t3))*cos(t4)-sin(t1)*sin(t4))*sin(t5)+(cos(t1)*cos(t2)*sin(t3)-cos(t1)*sin(t2)*cos(t3))*cos(t5), (cos(t1)*cos(t2)*sin(t3)-cos(t1)*sin(t2)*cos(t3))*d4+cos(t1)*a2*cos(t2)+sin(t1)*d2]
[ (((sin(t1)*cos(t2)*cos(t3)-sin(t1)*sin(t2)*sin(t3))*cos(t4)+cos(t1)*sin(t4))*cos(t5)+(sin(t1)*cos(t2)*sin(t3)-sin(t1)*sin(t2)*cos(t3))*sin(t5))*cos(t6)+(-(sin(t1)*cos(t2)*cos(t3)-sin(t1)*sin(t2)*sin(t3))*sin(t4)+cos(t1)*cos(t4))*sin(t6), -(((sin(t1)*cos(t2)*cos(t3)-sin(t1)*sin(t2)*sin(t3))*cos(t4)+cos(t1)*sin(t4))*cos(t5)+(sin(t1)*cos(t2)*sin(t3)-sin(t1)*sin(t2)*cos(t3))*sin(t5))*sin(t6)+(-(sin(t1)*cos(t2)*cos(t3)-sin(t1)*sin(t2)*sin(t3))*sin(t4)+cos(t1)*cos(t4))*cos(t6), -((sin(t1)*cos(t2)*cos(t3)-sin(t1)*sin(t2)*sin(t3))*cos(t4)+cos(t1)*sin(t4))*sin(t5)+(sin(t1)*cos(t2)*sin(t3)-sin(t1)*sin(t2)*cos(t3))*cos(t5), (sin(t1)*cos(t2)*sin(t3)-sin(t1)*sin(t2)*cos(t3))*d4+sin(t1)*a2*cos(t2)-cos(t1)*d2]
[ ((sin(t2)*cos(t3)+cos(t2)*sin(t3))*cos(t4)*cos(t5)+(sin(t2)*sin(t3)+cos(t2)*cos(t3))*sin(t5))*cos(t6)-(sin(t2)*cos(t3)+cos(t2)*sin(t3))*sin(t4)*sin(t6), -((sin(t2)*cos(t3)+cos(t2)*sin(t3))*cos(t4)*cos(t5)+(sin(t2)*sin(t3)+cos(t2)*cos(t3))*sin(t5))*sin(t6)-(sin(t2)*cos(t3)+cos(t2)*sin(t3))*sin(t4)*cos(t6), -(sin(t2)*cos(t3)+cos(t2)*sin(t3))*cos(t4)*sin(t5)+(sin(t2)*sin(t3)+cos(t2)*cos(t3))*cos(t5), (sin(t2)*sin(t3)+cos(t2)*cos(t3))*d4+a2*sin(t2)+d1]
[ 0, 0, 0, 1]


Top
 Profile  
    
 Post subject:
PostPosted: Tue 03-22-2005 4:28PM 
Offline
Major General
User avatar

Joined: Sat 10-18-2003 10:26PM
Posts: 2955
Location: Stone's throw from Garden of the Gods, Colorado Springs

Source: Wilson Library
Aside from all THIS, though, how you liking the Robotic Manipulators class? It's one I'm half thinking about taking when I get up there.

_________________
It's still UMR to me, dammit.


Top
 Profile  
    
 Post subject:
PostPosted: Tue 03-22-2005 6:04PM 
Offline
Sergeant

Joined: Sun 03-09-2003 9:34PM
Posts: 47

Source: CompSci Building
nsrbb5 wrote:
HAHAHAHHAHAHAHAHAHAH

what was tha command for simplifying, again?

Quote:
>> T60=A1*A2*A3*A4*A5*A6

T60 =

[ (((cos(t1)*cos(t2)*cos(t3)-cos(t1)*sin(t2)*sin(t3))*cos(t4)-sin(t1)*sin(t4))*cos(t5)+(cos(t1)*cos(t2)*sin(t3)-cos(t1)*sin(t2)*cos(t3))*sin(t5))*cos(t6)+(-(cos(t1)*cos(t2)*cos(t3)-cos(t1)*sin(t2)*sin(t3))*sin(t4)-sin(t1)*cos(t4))*sin(t6),
...
]


Well, there's only so much you can expect it to do.
You might try simplifying each individual step:
<ul>
tmp1=simplify(A1*A2);
tmp2=simplify(tmp1*A3);
...
etc.
</ul>
It might not be any better, but it's worth a try.

simplify and simple are different commands.
Take a look at the help on simple and it lists the
different techniques that it uses. It might be helpfull
to call them directly (collect, combine, convert, etc.)

Bill


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Tue 03-22-2005 6:46PM 
Offline
Major General

Joined: Sat 03-09-2002 12:57PM
Posts: 2026

Source: Sigma Nu
bagvwf wrote:
Aside from all THIS, though, how you liking the Robotic Manipulators class? It's one I'm half thinking about taking when I get up there.


i like it, but there are some things in the class that straight up get on my nerves (like this shit, for example). the lab is fun at first, but then a pain. programming a robot to pick up blocks from one pallet and place them in another is fun. then you program it to pick up from a conveyor, and from arbitrary locations using a camera to detect the blocks. but writing the labs is a pain in the butt because you have to describe every damn part of the program and what it does "; this line asks the user if he wants to proceed" yeah no shit. the test was redic. easy (72/75) but the homework is a lot like dalton's 279 homework-- you spend 3 hours on it and get 10/40 points on it. and then some shit like this... i don't even know how this is physically possible to do. not only is this hard, but i have to mutiply it by each of the inverses and solve for thetas. yes, i have to solve this monster for theta1-6.

that mechatronics class sounds cool, but they are just NOW offering it...


Top
 Profile  
    
 Post subject:
PostPosted: Tue 03-22-2005 6:59PM 
Offline
Captain
User avatar

Joined: Tue 02-24-2004 10:30PM
Posts: 150

Source: TJ South
What class is the mechatronics one? Is it a special topics or something? That sounds like fun to me.


Top
 Profile E-mail  
    
 Post subject:
PostPosted: Tue 03-22-2005 7:43PM 
Offline
Major General

Joined: Sat 03-09-2002 12:57PM
Posts: 2026

Source: Sigma Nu
i heard its about integration between mechanical, electronicics, control systems and some other stuff. i think anyone in MAEEM can enroll in it, it's going to be ME301.... what i gathered from an email i read.



is there anyway matlab can convert this shit into like cos(t1+t2+t3) or whatever? i think if i did that it might help..... but that's a whole lot of trig that i don't know how to do / am not willing to do by hand


Top
 Profile  
    
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group