Write a MATLAB code that can perform the following and answe
Write a MATLAB code that can perform the following and answer the questions below. 1. Generate an array A of 5x5 elements which elements are 0.147 0.975 0.156 0.719 0.157 0.058 0.785 0.067 0.818 0.035 A= 0.270 0.689 0.372 0.917 0.491 0.134 0.957 0.484 0.722 0.340 0.324 0.964 0.003 0.955 0.178 a. Use imshow to display A b. Find the average of all of its elements c. Find the maximum and minimum number in this array d. How many elements are greater than 0.5? What are they?
Solution
clc;
 clear all;
 close all;
x=[0.147 0.975 0.156 .719 .157; .058 .785 0.067 .818 .035;...
 .270 .689 .372 .917 .491; .134 .957 .484 .722 .340; .324 .964 .003 .955 .178]
Average_value=mean(x);
 Average_value=mean(Average_value);
 fprintf(\'\  Average Value = %.4f\ \',Average_value);
 Max_value=max(x);
 Max_value=max(Max_value);
 fprintf(\'\  Maximum Value = %.4f\ \',Max_value);
 Min_value=min(x);
 Min_value=min(Min_value);
 fprintf(\'\  Minimum Value = %.4f\ \',Min_value);
 count=0;
 fprintf(\'\ Elements greater than 0.5\ \');
 for i=1:5
 for j=1:5
 if x(i,j)>0.5
 fprintf(\'%.4f \ \',x(i,j));
 count=count+1;
 end
 end
 end
 fprintf(\'There are %d elements greater than 0.5\ \',count);

