% computes the error for the metropolis algorithm % To use, rename this file to "compute_error.m" % Problem type: % Estimating parameters for a differential equation system function err = compute_error( par ) time = [ 20 30 50 60 80 95 ]; value_U = [ .33 .25 .15 .15 .11 .10 ]; value_V = [ .70 .73 .88 .90 .86 .92 ]; global b f m b = par(1); f = par(2); m = par(3); [t,x] = ode45(@my_system,[0:1:100],[0.2 0.3]); err_U = sum( ( x(time+1,1)' - value_U ).^2 ); err_V = sum( ( x(time+1,2)' - value_V ).^2 ); err = err_U + err_V; % To plot, type: plot_ode(p)