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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Help with coding a matrix in Mathcad Prime 9.0

ReedzBeedz
3-Newcomer

Help with coding a matrix in Mathcad Prime 9.0

I am trying to write a code in Mathcad Prime 9.0 to make a K matrix by making the K0 matrix of zeroes populate with k matrix numbers as shown below and in the file attached. If anyone could please help me with the Mathcad code for that it would be much appreciated! (P.S. I do not have any experience with coding therefore I am not even sure where to start)

 

Here is my mathcad:

K1.png

 

 

 

 

 

 

 

 

 

 

 

This is what the K matrix should look like and it should be able to work for any n value

K matrix.png

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:ReedzBeedz)


@ReedzBeedz wrote:

... as shown below and in the file attached.

Unfortunately you had not attached your Prime file!

You also did not explain the algorithm used to create the K-matrix so I had to make a guess just based on the one example you show.

You have to modify it if the actual algorithm used is differently.

 

Here is a way to create the matrix K you are looking for (no need to create an all-zero matrix beforehand):

Werner_E_2-1708179299409.png

It works for vectors h and I of any (equal) length with the only limitation hat the vectors must have at least two elements.

 

You may also turn the calculation into an utility function as you did for the k-values (which as you can see can be calculated much easier in one go).
I made the function ORIGIN-aware so you could use it unchanged also in sheets with different ORIGIN setting and I show a rudimentary error check.

Werner_E_3-1708179339292.png

 

Prime 9 file including a few additional remarks is attached

 

View solution in original post

3 REPLIES 3

Hi,

See section 2.4 of enclosed file

Cheers

Terry

Werner_E
25-Diamond I
(To:ReedzBeedz)


@ReedzBeedz wrote:

... as shown below and in the file attached.

Unfortunately you had not attached your Prime file!

You also did not explain the algorithm used to create the K-matrix so I had to make a guess just based on the one example you show.

You have to modify it if the actual algorithm used is differently.

 

Here is a way to create the matrix K you are looking for (no need to create an all-zero matrix beforehand):

Werner_E_2-1708179299409.png

It works for vectors h and I of any (equal) length with the only limitation hat the vectors must have at least two elements.

 

You may also turn the calculation into an utility function as you did for the k-values (which as you can see can be calculated much easier in one go).
I made the function ORIGIN-aware so you could use it unchanged also in sheets with different ORIGIN setting and I show a rudimentary error check.

Werner_E_3-1708179339292.png

 

Prime 9 file including a few additional remarks is attached

 

Hello, thank you very much for your help this is exactly what I needed! Sorry about not attaching the file I must have missed that. Also, sorry about not explaining as much as I should have, I am very new to Mathcad and programming things in it so I wasn't sure how to explain. 

 

Thanks again!

Announcements

Top Tags