%HW3_Soloutions
%% Problem # 1
clc

f = @(x)sin(x).*exp(-x.^2); %The anonymous function to integrate

%See 'HW3_myIntFunc.m'

A=0; %Integration lower limit
B=1; %Integration upper limit

help HW3_myIntFunc

%Call the function once for each integration type. 
Out1 = HW3_myIntFunc(f,A,B,'MidPoint') 
Out2 = HW3_myIntFunc(f,A,B,'Trapezoid')
Out3 = HW3_myIntFunc(f,A,B,'Simpson')

%% Problem # 2

A = magic(5)  % Producing a magic 5*5 matrix.

ColSum = sum(A) %Sum of columns, or:
ColSum = sum(A,1) %Sum of columns, or:

RowSum = sum(A,2) %Sum of rows

B = A > 10;  % The elements of B are one where the elements of A are larger than 10, otherwise they are zero.
ElementsLarger10 = sum(sum(B)) % Sum of all of componenets of B, or:
ElementsLarger10 = sum(B(:)) 

A(A>10)=555   % Replacing elements of A that are larger than 10 by 555, or:
A(B)=555



