Results 1 to 4 of 4

Math Help - A Cubic regression to a number of points (2 independent variables!)

  1. #1
    Newbie
    Joined
    Jan 2010
    Posts
    5

    A Cubic regression to a number of points (2 independent variables!)

    Hi All,

    I posted this question to the pre-university problem a few days ago, but it seems nobody can answer, so I will try my luck here.

    I want to approximate a surface with a cubic regression in the following form. (Where X is the temperature, Y time and and z the energy requirement: Thus f(x,y)=z.)

    a⋅x^3+b⋅x^3+c⋅x^2⋅y^2+d⋅x^2⋅y+e⋅x⋅y^2+f⋅x^2+g⋅ y^2+ h⋅x⋅y+i⋅x+j⋅y+k

    However I am not sure if I wrote correctly the cubic equation???
    If somebody could tell me wherever it is correct or not. And if not, what is wrong :-)

    a,b,c,d,...etc. are the coefficients.

    By the way, what is the general form of such two variables dependent quadratic or cubic equations?

    Thanks a lot in advance.

    Cheers,
    Martin
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    Jan 2010
    Posts
    5
    it is a^x3+b^y3...sorry for the typing error (not a^x3+b^x3).

    cheers,
    Martin
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Super Member
    Joined
    Aug 2008
    Posts
    903
    Write it as:

    u(x,y)=a +bx+cy+dx^2+ey^2+fxy+gx^2y+hyx^2+ix^3+jy^3

    The following Mathematica code first generates a list {{x_1,y_1,z_1},. . .{x_n,y_n,z_n}} for the function \sin(xy) then fits the data points to u(x,y) then superimposes the plots to obtain a quick visual indication of how well the fit was determined.

    Code:
    f[x_,y_]=Sin[x y];
    mytable = Flatten[Table[{x, y, f[x, y]}, 
         {x, -1, 1, 0.1}, {y, -1, 1, 0.1}], 
        1]; 
    myequation = a + b*x + c*y + d*x^2 + 
        e*y^2 + f*x*y + g*x^2*y + h*y^2*x + 
        i*y^3 + j*x^3; 
    myconstants = FindFit[mytable, 
       myequation, {a, b, c, d, e, f, g, h, 
        i, j}, {x, y}]
    pic2 = Plot3D[myequation /. myconstants, 
       {x, -1, 1}, {y, -1, 1}, 
       PlotStyle -> Blue]
    Show[{pic1, pic2}]
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    Jan 2010
    Posts
    5
    Thanks a lot for your help, although I don't have mathemtica to use the code. But you helped me a lot writing correctly down the polynom!

    Cheers,

    Martin
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. independent variables
    Posted in the Advanced Statistics Forum
    Replies: 7
    Last Post: November 19th 2010, 11:19 PM
  2. Replies: 0
    Last Post: July 30th 2010, 12:21 AM
  3. Independent Variables
    Posted in the Advanced Statistics Forum
    Replies: 1
    Last Post: June 25th 2010, 08:51 AM
  4. independent variables
    Posted in the Advanced Statistics Forum
    Replies: 1
    Last Post: May 20th 2010, 05:43 AM
  5. Independent variables
    Posted in the Advanced Statistics Forum
    Replies: 1
    Last Post: January 24th 2009, 09:41 AM

Search Tags


/mathhelpforum @mathhelpforum