Matrix operation with equation

Hello, I have a equation:
X' = X + (0.7 * PN)
Where:
X = Matrix with size 2x2 as much as 64x4 (256)
PN = Matrix with size 1024x1
What should I do to get X', with the same shape and size with X?
Would you help me please?
Thankyou.

7 Comments

Can you describe what that equation is trying to do?
How do you intend to add matrices of different size? That is undefined behavior.
I want to change the value of X by X' using the equation above, do I have to change the size of X in advance to make the size of X be equal to the size of the PN? Because it will be the same number of elements, that is 1024.
Yes, they need to be of the same size to add them.
They do need to be of the same size, but how you should do it depends on what you're trying to represent. For example, it could be that PN should be replaced by a some kind of subsampled version of PN to make it the same height as X, and then replicated to the same width as X, or it could be that X needs to be expanded to the same as PN.
José-Luis
José-Luis on 29 Jan 2014
Edited: José-Luis on 29 Jan 2014
Correction: they need to have the same number of elements, unless you are adding a scalar to a matrix.
Can you help me to be able to work on this program as you say?

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 29 Jan 2014
If X' is the transpose of X, the only way that X and X' are the same size is when X is a square matrix

1 Comment

So I have to first change the size of X in order to be same with the PN? Because I should be able to also restore X' into the form of a 2x2 matrix, only it's value has changed.

This question is closed.

Products

Asked:

on 29 Jan 2014

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!