% This is an example of how to perform numerical integration in matlab
% The program will integrate the function (x^2 + k*x) from 0 to 4 and display the result
% Please note that the actual (x^2 + k*x) is evaluated in file intfunc.m
% EZ 050708

clear

% Get data from user
% ------------------
k=input('Enter value of k:');

% Perform numerical integration
% -----------------------------
% quadl = specifies the numerical method used for the integration
% 	  (other options are quad and quad8)
% intfunc.m = the file containing the function integrated
% 0 = lower integration limit
% 4 = upper integration limit
% k = additional parameter sent to intfunc 
%     (can be more than one - just add: ...,[],[],k1,k2,k3 etc)

result=quadl('intfunc',0,4,[],[],k);

% Display result
% --------------
disp(['Result: ' num2str(result)])
