FAQ  •  Login

Project 2: solving for q_doublt dot and lambda's

Moderators: Dan Negrut, RaduS

<<

f14-ewunsch

Newbie
Newbie

Posts: 23

Joined: Mon Sep 08, 2014 2:08 pm

Unread post Sat Dec 13, 2014 8:21 pm

Project 2: solving for q_doublt dot and lambda's

Hi guys,

I'm having trouble with my matrix functions in MATLAB. Specifically, I'm not sure how to go about solving for q_doubledot and lambda's from the equations of motion. I'm trying to solve for x using Ax=b -> x=A\b, but the matrix dimensions don't agree.

Please help,
Emily
<<

f14-jbhoward

Newbie
Newbie

Posts: 37

Joined: Mon Sep 08, 2014 2:08 pm

Unread post Sat Dec 13, 2014 9:01 pm

Re: Project 2: solving for q_doublt dot and lambda's

Emily-

That is the correct way to solve the formula. You must have incorrectly sized LHS and RHS of the lagrange multiplier formula, try something like this:

Initializing and solving LHS Matrix:
[rows_phiq,col_phiq]=size(Phiq_out);
c_max=col_m+rows_phiq;
r_max=rows_m+rows_phiq;
LHS=zeros(r_max,c_max);
Z=zeros(rows_phiq);
LHS(1:rows_m, 1:col_m)=M;
LHS(rows_m+1:r_max, 1:col_phiq)=Phiq_out;
LHS(rows_m+1:r_max,col_m+1:c_max)=Z;
LHS(1:col_phiq, col_m+1:c_max)=transpose(Phiq_out);

Initializing and solving RHS Matrix:
[size_g,~]=size(Gamma_out);
RHS=zeros(size_g+(columns_b*3),1);
Q=getQ(~,~,~,~,~);
[size_Q,~]=size(Q);
RHS(1:size_Q,1)=Q;
RHS(size_Q+1:size_Q+size_g,1)=Gamma_out;

Hope that help you out!
-James
<<

f14-jbhoward

Newbie
Newbie

Posts: 37

Joined: Mon Sep 08, 2014 2:08 pm

Unread post Sat Dec 13, 2014 9:11 pm

Re: Project 2: solving for q_doublt dot and lambda's

I have a question of my own:

What exactly does the nomenclature, 'n' and 'n+1' really mean in the Newmark equations? To elaborate, does solving the q_n+1 Newmark equation provide us with the value of q at the current time step or the next time step?

For example if we are beginning to iterate during the first time step does the final solution give us the values at that time or the time before/after it?
<<

f14-jwhendricks2

Newbie
Newbie

Posts: 21

Joined: Mon Sep 08, 2014 2:08 pm

Unread post Sun Dec 14, 2014 2:04 pm

Re: Project 2: solving for q_doublt dot and lambda's

It is solving for the current time step.

For example, in my code I used

for i = 2:timeSteps (where timeSteps = tend/stepSize)

so in the first iteration i = 2 because we already know the initial positions, velocities, and accelerations. Then n+1 = i and n = i-1. So it is solving for the current time step and n is the previous value.

The equations basically become:
q(i) = q(i-1) + h*qd(i-1) + (h^2/2)*((1-2*beta)*qdd(i-1) + 2*beta*qdd(i))
qd(i) = qd(i-1) + h*((1-gamma)*qdd(i-1) + gamma*qdd(i))

Did that answer your question?

-Jake Hendrickson
<<

Dan Negrut

Global Moderator
Global Moderator

Posts: 833

Joined: Wed Sep 03, 2008 12:24 pm

Unread post Sun Dec 14, 2014 4:58 pm

Re: Project 2: solving for q_doublt dot and lambda's

Emily - the dimension of the system should be 3*nbodies + m, where m is the number of constraints (kinematic and driving).
The Jacobian is a square matrix of (3*nbodies + m) X (3*nbodies + m).
It's expression is on slide 21 of 12/09. Look at J_tilde (the right side of the slide, in the middle).

James - you know everything at t_n, you iterate to find the state at t_{n+1}.
The time at which you evaluate any *explicit* functions of time should be t_{n+1}.

Thank you for helping each other.
dan

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

Who is online

Users browsing this forum: No registered users and 1 guest

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