QuestionQuestion

A1, A2, B1 and B2=are all cells which are constructed from different dimensioned matrixes such as 1 by 4, 1 by 5,1 by 6,1 by 7,1 by 8. The values in each matrix are different.

Just as an example:

A1={[1;2;3;2];[1;2;3;2];[1;2;3;2];[1;2;3;2]}
A2={[2;1;4;1]; [2;1;4;1]; [2;1;4;1]; [2;1;4;1]}
B1={[5;4;6;2]; [5;4;6;2]; [5;4;6;2]; [5;4;6;2]}
B2={[3;2;5;1]; [3;2;5;1]; [3;2;5;1]; [3;2;5;1]}

Check if A1>A2 for each element of A1 and A2 then count when A1>A2. Let's say counter is 8 since only 2 values of A1 is greater than A2 for each cell.

Check if A1 is not greater than A2 then I will check B1 and B2. If B1 >B2 then add counter. New counter value will be 16. Because of the fact that A1 is smaller in some values but in these values B1 is greater than B2. Get values where A1 is smaller than A2 then compare the B1 and B2. If both A1 and B1 are smaller than A2 and B2 then we will not add this item in the counter.

At the end, just sum the total greater values.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

%A12 records where A1 is greater than A2

%keeps track of the number of places where A1>A2
count_A12=0;
%keep track of the total number of elements in A1 (to start the counter for B)
n_elements=0;
for k=1:size(A1);
    count_A12=count_A12+length(find(A1{k}>A2{k}));
    n_elements=n_elements+length(A1{k});
end...
$13.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available MATLAB for Mathematics Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats