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

Solving System of Equations Within a Program Block

SOLVED
Highlighted
Newbie

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Solving System of Equations Within a Program Block

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
Highlighted

Re: Solving System of Equations Within a Program Block

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.

Highlighted

Re: Solving System of Equations Within a Program Block

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

Highlighted

Re: Solving System of Equations Within a Program Block

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

Highlighted

Re: Solving System of Equations Within a Program Block

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.

Highlighted

Re: Solving System of Equations Within a Program Block

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