No BSD License  

Highlights from
Alternative Mathematics using MATLAB 7

image thumbnail

Alternative Mathematics using MATLAB 7



13 Mar 2003 (Updated )

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

% ex186a.m: Find Parameters and Residual after the Fit       					     
clear all			
load ball.m;				% Load the data from file
T=ball(:,1);  Y=ball(:,2);			% Separate into two columns
options=optimset( 'TolX', 1e-10);	% Tolerance for [P(1) P(2)]
% Pm yields final Pm(1) and Pm(2)
Pm=fminsearch( @ssq2, [0 0] , options, T, Y)
ssq2min=ssq2( Pm, T, Y);		% Minimum value of ssq2
n=length(T)   				% Number of elements in T
sdev=sqrt( ssq2min/(n-1))		% Standard deviation
F=Pm(1)*T-  Pm(2)* T.^2;						% Function for best fit							        
figure(1),  plot( T,F,   T,Y, 'o'),  grid on	% Function and data points
Residual=F-Y;					% Deviation of F from data
figure(2),  plot( T, Residual, '*'),  grid on,  ylabel('residual')

Contact us