matlab - Fitting with V matrices -


I am trying to make a linear regression without using polyfit or polyval is part of a long project and i Actually I want to accomplish this without using these tasks. I think I have got a share of the polyfit, but I do not know how to compensate for the polyvalue. Here's what I've done so far:

  x = [1 2 3 4 5 6 7 8 9 10] '; Y = [2.50 922 2.12187 1.88092 1.94206 2.25718 2.79674 3.22682 4.09267 4.98531 6.37534] '; V = [x ^ 3 x ^ 2 x x ^ 0]; C = V \ y; % C = (V '* V) \ (V' * Y)% points and the best fitting curve plot: x = (0: 0.1: 11) '; Plot (x, y, 'o') hold on plot (xs, polywol (c, xs));   

Is this the correct way to compensate for the polyfit? And how can I do this without a polyvalue?

Any help would be appreciated!

This equation you solve for receiving coefficients, y = vc , now you know the V and c , related to using y :

 < code> yFit = [xs ^ 3xs ^ 2xs xs ^ 0] * c;   

Are you happy with the setup to use c using V \ y , do you think that this / why Works?

EDIT: To fit the high-degree function for programming, you can do something like this. Hopefully it's clear what's going on.

  x = [1 2 3 4 5 6 7 8 9 10] '; Y = [2.50 922 2.12187 1.88092 1.94206 2.25718 2.79674 3.22682 4.09267 4.98531 6.37534] '; V = [x ^ 0.]; Xs = (0: 0.1: 11) '; Vfit = [XS ^ 0.]; For i = 1: length (x) v = [x. ^ V]; C = V \ y; Vfit = [xs. ^ I Vfit]; YFit = Vfit * c; In the first loop, it fits a straight line in the data, the second time (x, y, 'o', xs, wifi, '-') draws pause and   

a quadratic , Fits on a cubic and so on.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -