• API
• FAQ
• Tools
• Archive
daily pastebin goal
69%
SHARE
TWEET

# Untitled

a guest Apr 25th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. function [F, V, a0, a1, r2] = LinRegrSGR(x, y, order)
2. % [vm, ks, r2] = sg_lin(S, v)
3. % Written by: ???, ID: ???
5. % Performs linear regression on the linear x and y data set
6. %
7. % INPUTS:
8. %  - S: linear independent data set
9. %  - v: linear dependent data set
10. % OUTPUT:
11. %  - vm: constant in v = vm * S^2/(ks + S^2)
12. %  - ks: constant in v = vm * S^2/(ks + S^2)
13. %  - r2: coefficient of determination
14.
15. % linearising data
16. xl = 1./(x.^order);
17. yl = 1./y;
18.
19. % determine a0 and a1 coefficients using polyfit
20. p = polyfit(xl,yl,1);
21. a0 = p(2);
22. a1 = p(1);
23.
24. % non-linear coefficients
25. F = 1./a0;
26. V = (F.*a1).^(1./order);
27.
28. % calculating r2
29. st = sum((yl-mean(yl)).^2);
30. sr = sum((yl-a0-a1*xl).^2);
31. r2 = (st-sr)/st;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top