×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

using vectors with Mathcad Given-Find blocks or using Given-Find blocks in a loop

using vectors with Mathcad Given-Find blocks or using Given-Find blocks in a loop

using vectors with Mathcad Given-Find blocks or using Given-Find blocks in a loop

(OP)
Hi there,

Looking up on the internet I found nothing about using vector variables in a MathCad Given-Find block, or using them inside a loop. Trying and trying I found a way.

This will be useful for those who want to solve several times the same equation using different parameters values and different guess values for the solve block, without having to use a Given solve block for each value at a time, but solving for all at once instead. It goes like this:

1. Define guess values variable as a vector the length of the number of equations you wish to solve
2. Start the Given block typing Given
3. Below the Given statement, type the equations you wish to solve as you would do for a single sized variable, but use the subindex indicator "[" next to each vector parameter or vector variable and put an undefined variable as subindex.
4. Define a function containing the Find funtion inside, with 2 parameters: the variable you wish to solve from the equation defined in step 3 and the variable in the subindexes I mentioned in step 3. This function should go like this: solveFunction(x,subindex)=Find(x)
5. Use a for loop or while loop to get all the solutions. Inside the loop, you must assign to each cell of a vector the "solveFunction" function with the "x" variable you want to solve (which is already defined as the guess values in step 1) and the loop counter variable as the "subindex" parameter. You actually will need to assign to each cell a subindex of the solverFunction (equals to the counter variable), since the solverFunction will return a vector the size of "x", with the current solution in the current loop counter number and all the oter values as the guess values assigned to "x" previously.

I hope this is useful. it was for me. Good luck!

RE: using vectors with Mathcad Given-Find blocks or using Given-Find blocks in a loop

The simplest approach is to assign the Find to a function whose variable is the one that will be changing:

Given

blah blah

f(x):=Find(y)

resi := f(xi)

Note that a sufficiently pathological set of constraint equations might require customized guess values, but most of the time, that's unnecessary

TTFN
I can do absolutely anything. I'm an expert!
homework forum: //www.engineering.com/AskForum/aff/32.aspx
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close