Code covered by the BSD License  

Highlights from
MATLAB in Physics - Visualisation

image thumbnail
from MATLAB in Physics - Visualisation by Matt McDonnell
The first lecture in a series on using MATLABĀ® in undergraduate physics courses.

pendulumFitFunction(t,y,params)
function fval = pendulumFitFunction(t,y,params)
% pendulumFitFunction : returns the fit value of pendulum model to
% experimental data (t,y)

%   Copyright 2008-2009 The MathWorks, Inc.

% Predicted motion
[tout, yout] = pendulumDE(t,params(1),params(2));

% Fitness value
fval = norm(y - yout(:,1));

Contact us at files@mathworks.com