FAQ  •  Login

MATLAB Assignment 4

<<

F11Jonathan

Newbie
Newbie

Posts: 29

Joined: Mon Sep 12, 2011 7:58 pm

Unread post Mon Oct 10, 2011 12:19 pm

MATLAB Assignment 4

Will we eventually be using a common data structure for bodies (body{1}.Mass=1)? Right now the adm processing file is simply assigning numbers to variables. Now that we are writing adm files containing multiple body definitions and constraints, if processed with the current matlab file, variables for one constraint will be overwritten by the variables for the next constraint.
<<

Dan Negrut

Global Moderator
Global Moderator

Posts: 833

Joined: Wed Sep 03, 2008 12:24 pm

Unread post Mon Oct 10, 2011 3:42 pm

Re: MATLAB Assignment 4

Jonathan - You are right - you need an array of bodies, otherwise this body will overwrite the previous body.
This is easy in MATLAB. Assume you have an array called bodyArray.
As you parse the adm file, when you find the first body you assign all the information to bodyArray[1]. Once you find another body, you will load all that info in bodyArray[2], etc.
Dan
<<

F11Wendy

Newbie
Newbie

Posts: 26

Joined: Mon Sep 12, 2011 7:58 pm

Unread post Mon Oct 10, 2011 3:48 pm

Re: MATLAB Assignment 4

Questions on adm file inputs for MATLAB assignment 4:

1. When defining a body, what do the "initial x & y coordinates" refer to? Are they the location of the origin of the local reference frame of that body in the global reference frame?
2. When defining an absolute x or y constraint are xPground/yPground the initial x and y coordinates of point P in the global reference frame?
<<

Dan Negrut

Global Moderator
Global Moderator

Posts: 833

Joined: Wed Sep 03, 2008 12:24 pm

Unread post Mon Oct 10, 2011 4:28 pm

Re: MATLAB Assignment 4

F11Wendy wrote:Questions on adm file inputs for MATLAB assignment 4:

1. When defining a body, what do the "initial x & y coordinates" refer to? Are they the location of the origin of the local reference frame of that body in the global reference frame?
2. When defining an absolute x or y constraint are xPground/yPground the initial x and y coordinates of point P in the global reference frame?


Wendy:
1. Yes.
2. Yes. One quick remark: it's not quite kosher to call it "initial" value. That point is fixed to ground, so its value doesn't change (the value is "final" as much as it is "initial").
Dan
<<

F11Christopher

Newbie
Newbie

Posts: 22

Joined: Mon Sep 12, 2011 7:58 pm

Unread post Tue Oct 11, 2011 11:39 pm

Re: MATLAB Assignment 4

Regarding Problem number 2. How do we define the body? Problem 3.1.1 gives no information to define a rigid body i.e. values for the variables listed in MATLAB Assignment 2 Problem 2.
<<

Dan Negrut

Global Moderator
Global Moderator

Posts: 833

Joined: Wed Sep 03, 2008 12:24 pm

Unread post Wed Oct 12, 2011 7:53 am

Re: MATLAB Assignment 4

F11Christopher wrote:Regarding Problem number 2. How do we define the body? Problem 3.1.1 gives no information to define a rigid body i.e. values for the variables listed in MATLAB Assignment 2 Problem 2.


Christopher - for kinematics, it doesn't really matter how you define a body; i.e., what its inertia (mass & mass moment) are, and where it is positioned, what initial velocity it has, etc.
I should qualify this statement by saying that the initial configuration (xZero, yZero, phiZero) will be used as a starting point by the iterative solver that solves the set of constraint equations to give you the assembled configuration of the mechanism at t=0. I'll talk more about this in class, but the idea is this: if you start with a good guess, the solver will find the solution quicker. This is relevant only at the t=0; i.e., at the beginning of the simulation (kinematic analysis). After that your xZero, yZero, phiZero for the body don't matter any longer.
Short answer: provide some bogus positive values, that should be fine.
Dan
<<

F11Christopher

Newbie
Newbie

Posts: 22

Joined: Mon Sep 12, 2011 7:58 pm

Unread post Wed Oct 12, 2011 11:14 am

Re: MATLAB Assignment 4

I'm a little confused on what Cmotionfunction is. For problem 2 the dynamic contraint is phi-sin(2t). Is that just Cmotionfunction, all the examples from previous assignments do not have another variable such as phi? And where does the Cmotionfunction definition go in our .adm file? In previous examples Cmotionfunction was just at the end of the constraint we were examining. Since we have multiple constraints for this problem do we just place it at the bottom of the file as it is itself a constraint? Thanks.
<<

Dan Negrut

Global Moderator
Global Moderator

Posts: 833

Joined: Wed Sep 03, 2008 12:24 pm

Unread post Wed Oct 12, 2011 5:30 pm

Re: MATLAB Assignment 4

F11Christopher wrote:I'm a little confused on what Cmotionfunction is. For problem 2 the dynamic contraint is phi-sin(2t). Is that just Cmotionfunction, all the examples from previous assignments do not have another variable such as phi? And where does the Cmotionfunction definition go in our .adm file? In previous examples Cmotionfunction was just at the end of the constraint we were examining. Since we have multiple constraints for this problem do we just place it at the bottom of the file as it is itself a constraint? Thanks.


I'm not sure which problem 2 you refer to, but in general, the motion would be "sin(2t)".
In general, and hopefully this answers the second part of your question, you have to specify the motion in conjunction with the joint that you have at hand. So if you have a motion on say revolution joint number 3, when you define joint number 3 specify in Cmotionfunction how the first body moves with respect to the second body. If you have a translational joint 6 and have a motion that specifies how the one body slides relative to the other one, specify the function of time in Cmotionfunction associated with joint 6. And so on.
I hope this helps.
Dan
<<

F11Kwang

Newbie
Newbie

Posts: 12

Joined: Mon Sep 12, 2011 7:58 pm

Unread post Thu Oct 13, 2011 6:34 am

Re: MATLAB Assignment 4

I have a quick question about problem1.

My MATLAB parser can scan the given adm file and save variables for BodyI, BodyJ, XPprimeI,.....,vPrimeJy and ComotionFunction(NONE). Is this what you asked me to make?

Should I put some more functions? It looks like you asked me to make a function that normalize the given vector. I am little confused. Is the problem1 asking me to make just a parser like previous assignment? Or, should I make a vector normalizing function or somethimg like that based on the scanned data?
<<

Dan Negrut

Global Moderator
Global Moderator

Posts: 833

Joined: Wed Sep 03, 2008 12:24 pm

Unread post Thu Oct 13, 2011 8:37 am

Re: MATLAB Assignment 4

F11Kwang wrote:I have a quick question about problem1.

My MATLAB parser can scan the given adm file and save variables for BodyI, BodyJ, XPprimeI,.....,vPrimeJy and ComotionFunction(NONE). Is this what you asked me to make?

Should I put some more functions? It looks like you asked me to make a function that normalize the given vector. I am little confused. Is the problem1 asking me to make just a parser like previous assignment? Or, should I make a vector normalizing function or somethimg like that based on the scanned data?


Kwang - you have to parse the file and save the useful data (input) in MATLAB variables that you will use later on to evaluate a Jacobian, RHS of acceleration equation, etc. Basically this is what you did in the past, parsing a file to get data out of it.

In terms of that vector vPrimeI, you should normalize it like [1/sqrt(2) 1/sqrt(2)]T so that you have a unit vector vPrimeI and thus simplify later on your life when you compute dot products with such a vector (remember that a vector w multiplied by a unit vector v gives you the length of the projection of w along the v direction. This is not true if v is not a unit vector).
I hope this helps.
Dan

Return to ME451 Fall 2011: Kinematics and Dynamics of Machine Systems

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software.