cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Solving System of Equations Within a Program Block

ptc-5305566
1-Visitor

Solving System of Equations Within a Program Block

Hi all,

I am fairly new to Mathcad, and am attempting to solving a 2-D system of equations within a program block as shown below. The section of code that I am attempting to use to solve my SOE begins with

'Given'

and ends with

'vvec <-- Find(V11val,V21val)'

and unfortunately this isn't working. 'vvec' is currently highlighted in red and when I hover my mouse over it, a message is displayed saying 'This variable is undefined'.

SOE+pic.png

If I use these same 4 lines of code in a regular math block rather than in a program block, they work just fine.

I'm wondering: it is necessary to use a different format when solving an SOE within a program block?

Thanks for any help!

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:ptc-5305566)

You can't define a solve block inside a program, but you can turn a solve block defined outside the program into a function depending on the parameters V21, V11, etc. and use that function inside your program.

BTW, the local variable h seems to be not in use and so could be omitted.

Please send a fully working sheet - we miss all the values of your variables M1, M2, various theta, etc.

View solution in original post

5 REPLIES 5

You can create the function vvec(...):=find(...) out of the program and call it in the program.

Send please the sheet and wewill try to edit it.

Thanks for your reply.

This is something that I do not know how to do. Could you please give me an example of how to set up the function outside of the program, and then call it inside the program?

Message was edited by: Keilan Freeman

Werner_E
25-Diamond I
(To:ptc-5305566)

You can't define a solve block inside a program, but you can turn a solve block defined outside the program into a function depending on the parameters V21, V11, etc. and use that function inside your program.

BTW, the local variable h seems to be not in use and so could be omitted.

Please send a fully working sheet - we miss all the values of your variables M1, M2, various theta, etc.

Werner_E
25-Diamond I
(To:ptc-5305566)

Here is a solution, based on dummy values for the variables you haven't shown.

I see that i was wrong concerning h, but I got rid of v11 and v21.

Not sure if the the output of the program is as you had it expected, though.

Thank you very much, that was exactly what I was trying to do! I apologize for not attaching a more useful script before; I now know for next time to do this. I really appreciate your help!

Announcements

Top Tags