Results 1 to 2 of 2

Math Help - Help with lsqcurvefit

  1. #1
    Newbie
    Joined
    Nov 2009
    Posts
    5

    Help with lsqcurvefit

    I'm newbie on matlab and I want to use lsqcurvefit to adjut 2 parameters, but this function is giving me a error that I coudn't solve.

    My function is,

    VEc=Vredm.*(((1-x).*K(1,1).*vass(1,1).*(X111-A1))+(x.*K(2,1).*vass(2,1).*(Y111-A2))+(((1-x).*KAB.*VassAB.*Y111.*(1-K(1,1).*X111))./((V(2,1)/V(1,1)).*(1-K(2,1).*Y111)+KAB.*Y111)));

    Vredm, x, X111, Y111 - 23 values each variable
    K, vass, V have - 2 values each variable
    A1, A2 - 1 value each variable

    KAB, VassAB - adjustable parameters

    When I give some values for KAB and VassAB, VEc runs OK, but when I use it in lsqcurvefit it give me this error,

    Error using ==> times
    Matrix dimensions must agree.


    Here is my lsqcurvefit function,
    [KAB,VassAB]=lsqcurvefit(@(KAB,VassAB) Vredm.*(((1-x).*K(1,1).*vass(1,1).*(X111-A1))+(x.*K(2,1).*vass(2,1).*(Y111-A2))+(((1-x).*KAB.*VassAB.*Y111.*(1-K(1,1).*X111))./((V(2,1)/V(1,1)).*(1-K(2,1).*Y111)+KAB.*Y111))),[1,1],x,ve);

    Please somebody could help me with this function?

    Thanks in advance.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member Jskid's Avatar
    Joined
    Jul 2010
    Posts
    160
    There is a problem with the way you are defining the anonymous function. Read this Anonymous Functions :: Types of Functions (MATLABŪ)
    Follow Math Help Forum on Facebook and Google+

Search Tags


/mathhelpforum @mathhelpforum