How do I generate random differences using the rows of matrices? Can Monte Carlo be used and how can it be used?

1 view (last 30 days)
Hello everyone. I have two matrices [A] and [B] with equal dimensions, 8760x 40. I have another matrix C _actual [8760 by40 ] well which i need to compare to the difference obtained from [A - B] which I have named C-diff(i,j)
Below is the explanation of this process:
A('row (i)value') -B('randomrow(i)value') =C_diff ('row(i)value'); % the difference between the particular row of A and the random value of row (i) in B should give me the closest value of C.
|C_diff(i,j)- C_actual|==min(Deviation) % the condition of operation
% the difference is only to be done within the rows.
A(1,1)- B(1,n) = C_diff(1,1)% such that n is the position occupied the value that gives the least deviation from the actual C(1,1)
% Perfect results
C_diff(i,j)=C_actual(i,j);
Please help out if you can.
  2 Comments
dpb
dpb on 18 May 2019
Sorry, can't follow...
Post a (SMALL) example of A and B and the desired result showing how you get the latter from the two...
Lui
Lui on 20 May 2019
Edited: Lui on 20 May 2019
A=[20 60 80 55; 30 80 90 72; 40 90 65 75];
B=[10 12 6 9; 15 5 18 14; 21 34 13 0];
C_actual=[13 40 62 40; 12 55 63 60; 20 60 44 60];
C_diff =[14 48 68 43; 12 62 72 58; 19 56 44 54];
C_diff is derived by taking the value of A(i,j) - [any value in the row (i) of B] such that the the results is closest to C actual. in which case it would be
C_diff=
20-6; 60-12;80-12; 55-12 % first row
30-18; 80-18;90-18;72-12 % second row
40-21; 90-34; 65-21; 75-21 % third row
That is the kind of expected results.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!