function sse=sse(param) %----------------------------------------------------------------------- % Evaluate the sum of squared error (sse), a scalar quantity, between data % point and a given function (which satisfies the following one-dimensional % diffusion-reaction equation. % Diffusion = Reaction % % (d^2y/dx^2) = f(y) BC: at x=0, dy/dx=0 % at x=1, y=1 % % where f is a function for saturation (Michaelis-Menten) kinetics % f = alpha*y(i)/(beta+y(i)) % alpha = input to this function % beta = input to this function % % This function is called by finitedr.m %----------------------------------------------------------------------- % Instructor: Nam Sun Wang %----------------------------------------------------------------------- % Although xDataz is not used in this specific example; however, it is % generally needed when the noisy test data points are not artificially % generated but are experimentally obtained. Likewise, xDataz is needed % when the number of test data points and the number of point used to % represent the given function y are not identical. global xDataz yDataz % Use my own variables alpha = param(1); beta = param(2); % The given function with the supplied parameters [x, y] = finitedb(alpha, beta); % Find the error between data points and the given function error = yDataz - y; sse = sum(error.^2);