Info

This question is closed. Reopen it to edit or answer.

How to calculate the linear regression of each cell of z value of array data?

1 view (last 30 days)
How can calculate the linear regression/trend for z value of array
for example 10*16*108 and I want to apply regression formula only on z value (108) which will give the output matrix 10*16 showing unique trend of each cell of data.
I have no idea to get required output.
  4 Comments
dpb
dpb on 14 Mar 2019
I have no idea what that means???
What do you want to fit to what?
I gather the content of the 3D array is the response variable, but what is the independent?
dpb
dpb on 14 Mar 2019
>> load subset
>> whos subset
Name Size Bytes Class Attributes
subset 817x941x23 17682331 uint8
>> subset(1:10,1:10,1:3)
10×10×3 uint8 array
ans(:,:,1) =
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
ans(:,:,2) =
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
ans(:,:,3) =
100 0 0 0 0 0 0 36 85 0
100 0 0 0 0 0 0 9 97 0
100 0 0 0 0 0 0 17 24 0
100 100 0 0 0 0 0 6 88 0
100 100 0 0 0 0 0 17 100 0
100 98 0 0 0 0 0 8 0 0
100 100 0 0 0 0 0 16 0 22
100 96 0 0 0 0 0 15 0 47
100 94 0 0 0 0 0 34 0 10
0 100 0 0 0 0 0 57 0 16
>> subset(1:10,1:10,end-4:end)
10×10×5 uint8 array
ans(:,:,1) =
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
ans(:,:,2) =
0 0 0 100 0 0 0 0 0 0
0 0 0 100 0 0 0 0 0 0
0 0 0 100 0 0 0 0 0 0
0 0 0 100 0 0 0 0 0 0
0 0 0 100 0 0 0 0 0 0
0 0 0 100 0 0 0 0 0 0
0 0 0 100 0 0 0 0 0 0
0 0 0 100 0 0 0 0 0 0
0 0 0 100 0 0 0 0 0 0
0 0 0 100 0 0 0 0 0 0
ans(:,:,3) =
100 100 100 100 100 100 100 100 100 0
100 100 100 100 100 100 100 100 100 0
100 100 100 100 100 100 100 100 100 0
100 100 100 100 100 100 100 100 100 0
100 100 100 100 100 100 100 100 100 0
100 100 100 100 100 100 100 100 100 0
100 100 100 100 100 100 100 100 100 0
100 100 100 100 100 100 100 100 100 0
100 100 100 100 100 100 100 100 100 0
100 100 100 100 100 100 100 100 100 0
ans(:,:,4) =
0 0 100 0 0 100 100 100 100 100
0 0 100 0 0 100 100 100 100 100
0 0 100 0 0 100 100 100 100 100
0 0 100 0 0 100 100 100 100 100
0 0 100 0 0 100 100 100 100 100
0 100 100 0 0 100 100 100 100 100
0 100 100 0 0 100 100 100 100 100
0 100 100 0 0 100 100 100 100 100
0 100 100 0 0 100 100 100 100 100
0 100 100 0 0 100 100 100 100 100
ans(:,:,5) =
100 100 100 100 100 100 100 100 100 100
100 100 100 100 100 100 100 100 100 100
100 100 100 100 100 100 100 100 100 100
100 100 100 100 100 100 100 100 100 100
100 100 100 100 100 100 100 100 100 100
100 100 100 100 100 100 100 100 100 100
100 100 100 100 100 100 100 100 100 100
100 100 100 100 100 100 100 100 100 100
100 100 100 100 100 100 100 100 100 100
100 100 100 100 100 100 100 100 100 100
>>
I see nothing theere about 10*16*108 and absolutely nothing that looks like would be a suitable indepenent variable for fitting against, nor does there seem to be any trend in the data in the array itself that makes any sense to put a trend line through.
Show us a SMALL example of what yuo think your data is and what you want to do with it.

Answers (0)

This question is closed.

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!