Skip to main content
4-Participant
February 8, 2025
Solved

The value must be scalar or a matrix issue using range to create values for plotting

  • February 8, 2025
  • 1 reply
  • 1446 views

I'm not able to understand, what's causing the error when I create a range. Please review and guide, next step would be plotting with the values. 

Using Mathcad 10

DJ_12857440_0-1739024786221.png

 

Best answer by Werner_E

Don't use the vector index "i" at m.air (or use it at m.air AND Th2)

Werner_E_0-1739060488642.png

BTW, I am not good in inventing names for variables - you sure can find better names for "collectLMTDcntf", etc. 😉

 

1 reply

25-Diamond I
February 8, 2025

Its hard up to impossible to debug a picture.

If ever possible always attach the worksheet itself.

 

In your case the reason for the error seems to be that you did not consider the difference between a range and a vector.

A range is just kind of an implicit loop, its NOT a collection of various values!

 

Her one way to define m.air as vector, not as range (assuming that ORIGIN is at its default value 0)

Werner_E_0-1739026878688.png

Note that the "i" is a vector/matrix index, not a literal index as "air".

 

Ranges should only be used for three reasons:

  • To index the elements of a vector/matrix (as in the example above)
  • To form a for-loop in a program
  • To make the abscissa in a plot

 

Remark: Up to version Prime 9 we could convert easily a range into a vector using an undocumented trick. PTC promised to provide a "legal" way to do so in Prime 11.

Here in the forum you will find user-defined functions which turn a range into a vector and also function which create a vector with a sequence of values by providing the first, second and last value (similar to the range definition).

 

Some additional comments:

As Th2 would be a vector as well, chances are that you have to vectorize the function call to F_CrossFlowHX...

When displaying the result of the difference of two temperates given in °C, you should not use °C but rather Delta°C (equivalent to Kelvin).

Werner_E_1-1739027698911.png

 

 

4-Participant
February 8, 2025

Apologies, if I missed to attached worksheet on my post. Please see attached worksheet.
I tried using your example, but still have error. 

25-Diamond I
February 8, 2025

You did not write a vector index i when defining m.air but rather renamed the variable in mi.air.

And when you call the function F_CrossFlowHX... you have to use vectorization (the arrow over the expression) to apply the function to every element in he vector.

As your function return a 2x5 matrix, you get a nested vector with 26 elements, each of which is a 2x5 matrix.

When you talked about plotting in your initial post - did you had something like this in mind?

Werner_E_0-1739030032879.png

 

See the attached worksheet.