linear regression with matrix

Hi guys, I am new to mablat. I have 4 4424x2380 matrixs and I want to analyst every single point of the matrix. That means I need to have a equation for, for instance, colume 3 row 3 number for 4 matrix for further use. Can anyone know how to do it? No worry about the computing power.

4 comentarios

Ho Leung Louise FUNG
Ho Leung Louise FUNG el 1 de Nov. de 2022
for instance
a= [2 2 5]
[13 2 6]
[3 3 9]
b= [5 6 1]
[2 14 53]
[6 12 42]
I need a linear equation for a11 and b11 and a22 and b22
I guess it is kind of matrix transformation and fitlm() may help me.
But fitlm require one of the matrix be single
Torsten
Torsten el 1 de Nov. de 2022
I need a linear equation for a11 and b11 and a22 and b22
Unclear what you mean.
Star Strider
Star Strider el 1 de Nov. de 2022
What is being regressed with respect to the independent and dependent variables?
John D'Errico
John D'Errico el 1 de Nov. de 2022
Editada: John D'Errico el 1 de Nov. de 2022
A linear regression requires an independent variable, AND a dependent variable. It seeems your dependent variable may be the numbers contained in these 4 matrices. PLEASE LEARN TO USE MATRICES PROPERLY. @Atsushi Ueno has suggested you should be storing these numbers in one array, of size 4424x2380x4. That is a wonderful idea. But it still does not answer the relevant question, that is, what is the INDEPENDENT variable in the regression you want to perform? Essentially, it looks like y is a vector of length 4. But what is x?

Iniciar sesión para comentar.

Respuestas (1)

Atsushi Ueno
Atsushi Ueno el 1 de Nov. de 2022
Editada: Atsushi Ueno el 1 de Nov. de 2022
How about stacking them as a 4424x2380x4 matrix?
A = ones(4424,2380);
B = ones(4424,2380);
C = ones(4424,2380);
D = ones(4424,2380);
E = cat(3,A,B,C,D);
size(E)
ans = 1×3
4424 2380 4
E(3,3,:) % for instance, colume 3 row 3 number for 4 matrix for further use.
ans =
ans(:,:,1) = 1 ans(:,:,2) = 1 ans(:,:,3) = 1 ans(:,:,4) = 1

Preguntada:

el 1 de Nov. de 2022

Editada:

el 1 de Nov. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by