clear all
close all
addpath(genpath('/Users/Mau/Documents/MATLABhelp_new'));

% Efficiency of the pump for SN34

Ppsi=[
200;
500;
1000;
1200;
1500];

psi2dbar=0.689476;
P=psi2dbar*Ppsi; % in dbar

E=[
134.1345;
212.876865;
361.30884;
479.9196;
574.08];

[S,b,r,pval]=regresion(P,E,1); % uses some neural network toolbox function (mse.m)
% for error estimation
xlabel('P [dbar]')
ylabel('E [J]');

% to double check:
X = [ones(length(P),1) P];
C = X\E;
% coefficients are in units of E/P, i.e. J/dbar

% dividing by volume of oil pumped
% 30cc=30*10^(-6) m^3
vol=30*10^(-6);

Jo=b./vol
J=S/vol