Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Help Writing a Complex For Loop

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

06-13-2013
01:01 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-13-2013
01:01 PM

Help Writing a Complex For Loop

I am trying to write a for loop that will take values from two different matrices and create one 2x1 matrix and one 2x2 matrix. The purporse of the 2x1 and the 2x2 is to take the inverse of the 2x2 times the 2x1 to solve for 2 unkown variables. The matrices that are being pulled from are 15x3 originally. I am assuming one of my 3 unknowns to be equal to 1 and therefore enabling me to solve two equations for two unknowns simultaneously. I am using mathcad prime 2.0 to do this. I will attach a worksheet showing what I am trying to do. At the bottom of the worksheet is an italicized section named "Solve for Un-Normalized Force Vector". I have it done for one set of values but dont want to have to go through and redo it 14 more times to get my results. I am new to programming loops and such so I am trying to teach myself as much as possible.

Any help and suggestions are much appreciated.

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

06-13-2013
02:02 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

4 REPLIES 4

06-13-2013
02:02 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-13-2013
03:49 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-14-2013
10:10 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-14-2013
10:10 AM

In the Tie Down Analysis_2 that you helped me with, I know there is a way to combine the 3 for loops into one for loop correct? So instead of mathcad going through and running 15 iterations three time, it only runs the 15 iterations once and still outputs the matrices. Would I just have to define a new "vec" and have it return that each and every time? Does what I am asking make sense?

06-14-2013
11:02 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

06-14-2013
11:02 AM

I am not sure which three for-loops you are talking of.

You can calculate Rcs, Rcsp, Fs and also fs in one for loop. Care has to be taken with Fs, as the denominator requires all rows of Rcsp to be already known.

As a program in MC can only return one result, you have to pack all result matrices as elements in one result vector. I have chosen to name them new_... to be able to compare with the earlier results.