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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Solving Blocks in MATHCAD Prime 8

RM_10584029
4-Participant

Solving Blocks in MATHCAD Prime 8

Previous message:

Hello, I am trying to use the "Solve Block" in MATHCAD 8 to evaluate physical constants of materials using experimental values. I have impedance measurements and phase measurements and I obtained some equations that I am trying to place in a system.

I used, I assume correctly, the Boolean "=" in the constraints field, defined some guess values and asked for the solution, like in the following text (I omit the rest because otherwise is too long). Nevertheless, there are inconsistencies probably due to the utilization of indexes (my quantities depend on the frequency, while in several examples I have seen just numbers). The red circles around variables to be calculated mean "a function or a variable name is required here".

 

May you help me?

 

 

New message:

Sorry, I used the PDF in my previous message for simplicity because the code is quite long, and my problem is general: how to use the "solve block" when the quantities in the constraints have an index? My equations concern variables having an index because they are components of a vector that is a function of frequency (each index "j" is one different frequency for me). So far, if I have x(j)^2 instead of x^2, which is the correct way to use the "solve block"? Have you an example where I have to solve a system of equations belonging to a loop with variables having an index?

 

 

4 REPLIES 4
Werner_E
25-Diamond I
(To:RM_10584029)

The solve block with "find" can only be used to solve for variables, not for functions.
But the solve block itself can be turned into a function of j as you already did when you wrote vec(j):=Find(...).

You must omit the "(j)" part from the variables you are looking for to make them simple variables and not functions.

Simple example:

Werner_E_0-1695294215492.png

Not seen in the screen shot - the definition of f is f(j):=j.

 

BTW, its strange that in your pdf part of the equations are written in blue which usually indicates units and  not variables?

 

RM_10584029
4-Participant
(To:Werner_E)

Unfortunately, the situation is more complicated than expected...

If I succeed, I shall try to send you a self-consistent part extracted from my code to be more precise (in mathcad and not in pdf).

For me, "j" is the index defining a running frequency, part of a data file read before, and the quantities I would be able to define in the solve block should depend on "j".

The vector suggested for the solution of my problem is probably a vec(k), with k indicating the index for a vector, including the three quantities I have to find, i.e., the real and imaginary part of a dielectric constant and a parasitic capacitance fitting my experiment.

I hope to be able to send you a simplified code to illustrate the problem including my comments.

Thank you very much,  Romolo

Hi Romolo,

 

When working with indexes, it might work better to use the index feature rather than the function feature. e.g.:

KevinFinity_1-1696358453532.png

 

This way, you're working only on the j'th index of a vector. You'll only have to load the data file once, and you can incorporate it into a simple for loop; e.g.:

KevinFinity_2-1696358561954.png

The shortcut key to indexing is the left bracket "[" key, not to be confused with the subscript shortcut ctrl+-

 

Try removing "(j)" from each of the inputs in the Find function.

KevinFinity_0-1696358075032.png

You're getting this error because Find looks for the guess values, and it's looking for them as defined previously in the solve block, even if you've defined them as functions. Try writing:

 

vec(j) := Find(e'M, e''M, Clfit)

 

It's fine to write "vec(j)", though, because it's outside the Find function. You will have to call it later, outside the find function, with a specific j to determine its value, and it will work as a function with different values of j as well. 

 

Announcements

Top Tags