No BSD License  

Highlights from
Alternative Mathematics using MATLAB 7

image thumbnail

Alternative Mathematics using MATLAB 7

by

 

13 Mar 2003 (Updated )

Self-instructive text on undergraduate algebra, statistics, differential and integral calculus.

ex152.m
% ex152.m:  Trapezoidal Integration					         
clear,  echo off,  format long
xn=input('xn= (e.g. 1) ');		% Right end coordinate
x1=0;  n=500;				% Number of sub-intervals
h=(xn-x1)/n;  				% Length of sub-interval
X=x1:h:xn;  F=cos(X);				
integral=sum(F)* h - (F(1)+ F(n)) /2*h;			
int_ex=sin(xn)-sin(x1);			% Exact integral
integrals=[integral  int_ex]		% Display comparison
format short e,  error=integral-int_ex

Contact us