Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Re: Shift values in matrix

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-07-2021
04:15 AM

04-07-2021
04:15 AM

Shift values in matrix

Hey, I liked to know how to shift the values at matrix by a certain value like this.

I have script in MathCad and matrix with hundreds values, and I need it to work automaticly. Thanks for help.

9 REPLIES 9

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-07-2021
04:39 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-07-2021
05:26 AM

04-07-2021
05:26 AM

Re: Shift values in matrix

Thanks a lot, it works, you are very kind.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-07-2021
07:35 AM

04-07-2021
07:35 AM

Re: Shift values in matrix

Here are my 2 cents

In contrary to Luc's "Mrot", my "Mshift" uses programming and therefore does not work in the limited Prime Express version. Also notice that Mrot and Mshift rotate/shift in different directions.

Doubling the data by stacking the matrix on top of itself is bold and may be considered inefficient, but this should not be a problem with matrices of just a few hundreds of rows 😉

You may also use the same function to shift both rows and columns:

P6 worksheet attached

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-08-2021
11:09 AM

04-08-2021
11:09 AM

Re: Shift values in matrix

It can be with built in functions:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-08-2021
11:13 AM

04-08-2021
11:13 AM

Re: Shift values in matrix

Or just by mangling with indices as follows:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-11-2021
02:13 AM

04-11-2021
02:13 AM

Re: Shift values in matrix

Or a pure math solution:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-11-2021
09:39 AM

04-11-2021
09:39 AM

Re: Shift values in matrix

Yes, there are multiple roads that lead to Rome.

I guess that for shifting/rotating the rows of a vector or matrix, first filling an nxn matrix is a bit overdone. Besides, this method doesn't work (as intended) for shifting/rotating rows of matrices....

Luc

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-11-2021
10:38 AM

04-11-2021
10:38 AM

Re: Shift values in matrix

@LucMeekes wrote:

Yes, there are multiple roads that lead to Rome.

I guess that for shifting/rotating the rows of a vector or matrix, first filling an nxn matrix is a bit overdone. Besides, this method doesn't work (as intended) for shifting/rotating rows of matrices....

Luc

I agree that the way the idea was presented isn't very practical for actual use.

But the principle can be turned into a convenient utility function which works on the rows of matrices, too 😉

Because the "matrix" function ignores the setting of ORIGIN, the function should also be ORIGIN-aware.

On the other hand ... it seems that @PZ_9812318 is no longer interested in his question. 😞

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-12-2021
05:41 AM

04-12-2021
05:41 AM

Re: Shift values in matrix

It is possible to generate the rotation matrix if you do not feel like filling it in with 0 and 1 manually.

If you need to populate a sparse matrix - you only need to set the values that are not equal to 0, others will become zero automatically. The dimension is defined by the largest row and column indices that you used while assigning values to specific elements.

j in the example contains an expression of i, that define how elements will be reordered.