Question: % Practice Exercise 8 . 1 . 7 and 8 % Consider the following array x = [ 1 1 0 4 2 6 5

% Practice Exercise 8.1.7 and 8
% Consider the following array
x=[110426
587823
5645913
232289];
%8.1.7 a) Using single index notation, use the find function to find the index numbers
% of the elements in the array that contain values between 10 and 40 or between 70 and 80.
% Call your result index.
index = find((x >=10 & x <=40)|(x >=70 & x <=80));
index = index(1:min(5, numel(index)));
% b) Report the values in the array that are between 10 and 40 or between 70 and 80.
% Call your answer values.
values = x(index);
disp('Values:');
disp(values);
%8.1.8 Use the length function and your results from part a or b to determine how many values in the array
% meet the criteria from this problem. Name your result total
total = length(values);
disp('Total:');
disp(total);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!