I have been trying executing my data for sparse matrix, and i have been following the example that can be execute but for my data it cant where my data is A is 25x10 and B is 10x1 to solve for x but when i try to solve it shows that A is 10x25 and B is 1x10 and cant be executed.

Respuestas (1)

Torsten
Torsten el 14 de Mayo de 2023
Editada: Torsten el 14 de Mayo de 2023

0 votos

Don't post pictures, post your code in plain ascii so that we are able to copy and execute it.
Your A in the picture you posted has 10 rows and 25 columns, thus is 10x25, not 25x10.
Similarily, the B in the picture you posted has 1 row and 25 columns, thus is 1x25.
You want to solve for X in
A*X = B
where A is 25x10 and B is 10x1 ?
That's not possible: B must be 25x1 to get X as 10x1.

4 comentarios

Zainulariffin Hakim Mohamad
Zainulariffin Hakim Mohamad el 15 de Mayo de 2023
A = sparse ([1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,1,0,1,0,0,0,0,1,1; 1,1,0,0,1,1,0,0,0,0,1,1,1,1,0,0,1,1,0,1,0,1,1,0,0; 1,0,1,0,1,0,0,0,1,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,0; 1,1,0,1,0,1,1,1,0,0,0,1,1,0,0,1,0,1,0,0,1,0,0,1,0; 1,1,1,0,1,1,1,1,0,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1,0; 1,1,0,1,0,1,1,1,1,0,1,1,0,0,0,1,1,1,1,0,1,0,0,0,0; 0,1,0,0,1,0,1,0,1,0,0,0,1,1,0,1,1,1,0,0,0,0,0,0,0; 1,1,1,0,0,1,0,1,0,0,0,1,1,1,1,1,1,0,0,0,1,1,0,0,1; 1,0,1,0,0,1,1,1,0,0,0,0,1,1,0,0,1,1,1,1,0,0,0,0,0; 0,1,0,1,0,0,0,1,0,1,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0]);
B = sparse ([4986 5265 5469 5247 5277 4717 5410 5115 5251 4676]);
A is the randomize value i get for my 5x5 matrix which i made 10 samples where i want to make it 10 rows and 25 columns for those 10 samples and a matrix
B is the value i got from those samples
and i want to solve for x
and im doing this for my radiation imaging using compressed sensing
and i have question am i using the right command for my imaging using compresses sensing? and can i insert my data into the l1 norm? is the matrix above already included l1 norm? can i use the value x for my imaging if i can execute the above matrix? or do you have any suggestion?
Disclaimer i have 0 knowledge in matlab Thank you in advance
Zainulariffin Hakim Mohamad
Zainulariffin Hakim Mohamad el 15 de Mayo de 2023
the upper picture is just me trying and error
Torsten
Torsten el 15 de Mayo de 2023
Editada: Torsten el 15 de Mayo de 2023
Your question was about the dimensions of A and B in
A*X = B
so that the equation can be solved for X.
If A is (nxm) and B is (nx1), you'll usually get a "solution" X of size (mx1).
For the other questions, you should open a new task and describe your problem more comprehensible. I have no experience in image processing.
Zainulariffin Hakim Mohamad
Zainulariffin Hakim Mohamad el 15 de Mayo de 2023
I see alright thank you for your explanation and time good sir.

Iniciar sesión para comentar.

Categorías

Más información sobre Sparse Matrices en Centro de ayuda y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by