function [error]=energy(opl) global h yexrek N som=0; for i=1:N-1, som=som+0.5*(h(i)+h(i+1))*(yexrek(i)-opl(i))^2; end error=sqrt(som);