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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Unable to plot a Function with Units calling a Solve Block

John_G
1-Newbie

Unable to plot a Function with Units calling a Solve Block

I would like to plot directly from a function I've written in Mathcad 15 (MC15) to plot data across values of one parameter, input as either a range variable or a vector, but am unfortunately unable to make this work. 

The function, Tsrfc() calls a solve block in a fashion similar to the quicksheet Parameterizing Solutions, and like that example includes units.  Tsrfc() is validated using a thermal analyzer application, but currently works for only one value of insulation thickness, tinsl.  Within the MC15 Area named Geometry examples of attempts to implement tinsl as a range variable [error message: This variable must be a scalar or matrix] and as a vector [error message: No solution was found.  Try changing the guess value or the value of TOL or CTOL] can be seen, temporarily deactivated by a leading underscore, _.

If plotting directly from a call to this function in a worksheet is not possible, then I would like to call the function in an in-line program, populating a vector, which I can then plotted.  Please advise.

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

See if the attached helps.

Alan

(NB The graph is plotted in the default SI units)

View solution in original post

6 REPLIES 6

You have the f(x, y, z)=0 close function! (or f1(x, y, z)=f2(x, y, z))

You would like to input x and y and calculate (and show on the plot) z

to input y and z and calculate (and show on the plot) z

to input x and z and calculate (and show on the plot) y?

I appreciate your response Valery.

I do not fully understand the questions but possibly referring to either Alan's or Werner's solutions could clarify them for you as both allow the function to work the way I need it to work.

Thanks,

John G.

See if the attached helps.

Alan

(NB The graph is plotted in the default SI units)

Thank you for the solution Alan.  With the technique you provided I am able to make progress again.

I see that my function, Tsrfc() and each of the input parameters that change with insulation thickness (tinsl), that is rinsl_out, and rair_in, need to be called explicitly as a member of an array for a given iteration. And I was missing that explicit call in the form of a subscript to the row of the matrix containing the parameter.

Again I appreciate your help.

John G.

Werner_E
24-Ruby V
(To:John_G)

I am not sure but as I understand it, you want to calculate the surface temperature T.surface dependend on just the insulation thickness t.insl.

But your function T.srfc is defined as being dependent on 17 arguments, none of which is t.insl. I have rather found two function arguments which in their turn are dependent on t.insl, that are r.insl_out and r.air_in. Hope I have not missed any other variables dependent on t.insl.

BTW, does it really makes sense to keep r.insl and r.air_in as separate parameters? You define r.air_in:=r.insl anyway, so you could replace one for the other in your function anyway and reduce to 16 arguments.

So why not create a function for the surface temperature with just one argument, t.insl. You can use that function for evaluating single temperatures, plotting T.surface over t.insl or to evaluate a vector of thickness values (you would have to use vectorization to do this).

Hope the attached sheet will help.

This answer is also correct (however I need to find out how to mark it as such, now that I have already declared one answer correct).


Thank you Werner for your helpful solution.  This also works, and it seems is elegant, which I appreciate.  Thankfully I have two optional solutions to consider.

John G.

Top Tags