## MATLAB Assignment 4

### 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

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

### 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?

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?

### 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

### 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.

### 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

### 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.

### 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

### 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?

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?

### 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

10 posts
• Page

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

### Who is online

Users browsing this forum: No registered users and 1 guest