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

Translate the entire conversation x

Matrices

Sergey
15-Moonstone

Matrices

Hello!

 

Is it possible to do the following:

I have two matrices, say 5x1, but want to perform computation using 4 elements of both matrices. In other words I want to omit one row (value) form the computation. The result will be vectorized. 

 

Best regards,

Sergey

ACCEPTED SOLUTION

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

So I think that trimming the final result seems to be the best way to do. But not using my 'deleteRow' but rather the built-in 'trim' 🙂

Werner_E_0-1768550522292.png

 

View solution in original post

7 REPLIES 7

--------------------------------

Screenshot_1.png

Sergey
15-Moonstone
(To:NickKemaev)

Спасибо за методику. Протестирую

 

Сергей

Werner_E
25-Diamond I
(To:Sergey)

For the special case of two vectors you could use something like this

Werner_E_0-1768501971810.png

This works as long as the original vectors do not contain any NaN's.

 

A more generic approach is the use of submatrix. But I would rather apply it to the result and not to the input vectors.

Problem with submatrix is that it needs some special treatment if you want to omit the very first or the very last row.

So it would be beneficial to use a utility function which deletes any row from an arbitrary matrix.

Werner_E_1-1768502206044.png

 

Unfortunately you don't explain why you would want to omit a specific row. 

If you want to omit a specific row because this would throw an error like in

Werner_E_2-1768502379087.png

the aforementioned  methods will not work and it would be necessary to omit the offending row before applying the operation.

Using the utility function shown above this could be done that way:

Werner_E_3-1768502592953.png

 

Werner_E
25-Diamond I
(To:Werner_E)

Looks like I tried to re-invent the wheel 😞

 

There is no need for a custom made utility function "deleteRow(M,r)' because the built in function "trim(M,r)" does the very same job and you could also use it to omit more than just one row:

Werner_E_0-1768511247153.png

 

 

Sergey
15-Moonstone
(To:Werner_E)

"Unfortunately you don't explain why you would want to omit a specific row" - I will try to explain.

 

I have a parameter in my calculations. Say, q=100mm. This parameter is a part of an equation. But I want to perform the computation of the several cases simultaneously when q=100mm, 200mm, 300mm and so on. That is why I use 5x1 matrix. But in one case, I want to ommit the value of q=200mm because this is meaningsless in my case. This is the prime reason of me asking about the omiting technique in Mathcad using matrix operators.

 

Werner_E
25-Diamond I
(To:Sergey)

So I think that trimming the final result seems to be the best way to do. But not using my 'deleteRow' but rather the built-in 'trim' 🙂

Werner_E_0-1768550522292.png

 

Sergey
15-Moonstone
(To:Werner_E)

Looks like the solution I need.

 

Sergey

Announcements

Top Tags