Skip to content

Instantly share code, notes, and snippets.

@jschwinger233
Last active August 29, 2015 14:01
Show Gist options
  • Save jschwinger233/eea908eb9f5c702f52cf to your computer and use it in GitHub Desktop.
Save jschwinger233/eea908eb9f5c702f52cf to your computer and use it in GitHub Desktop.
f = xlsread('C:\Documents and Settings\Administrator\桌面\恒定流-非恒定流关系图.xls')
fun = @(x, xdata)xdata(:, 3).* xdata(:, 4).^ x(1).* xdata(:, 5).^x(2).*xdata(:, 6).^ x(3)* x(4);
lsqcurvefit(fun, rand(4, 1), f, f(:, 2))
%% output
-1.99891623025666
0.627151427841047
-0.0645792624367950
8.20564570528408
f = xlsread('C:\Documents and Settings\Administrator\桌面\恒定流-非恒定流关系图.xls');
logf = log(f);
fun2 = @(x, xdata)xdata(:, 3)+ x(1)* xdata(:, 4)+ x(2)* xdata(:, 5)+ x(3)* xdata(:, 6)+ x(4);
c = [ff(:, 4:6), ones(size(ff, 1), 1)];
d = ff(:, 2) - ff(:, 3);
x3 = lsqlin(c, d, [], []);
% output
-1.69934227572503
1.00672073832549
-0.103933155909792
3.41567959152986
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment