MATLAB Problem

Discussion in 'Computer Science & Culture' started by canadian, Sep 23, 2004.

Thread Status:
Not open for further replies.
  1. canadian Registered Member

    Messages:
    4
    I was doing some coding in Matlab. I have this function --

    (-1/3*x-1/3*y+1) / sqrt ( (x-a)^2 + (y-b)^2 )

    where, a and b are decimal numbers which I pass into the function. For example - 0.543575643. Also 0 <= a,b <= 1

    The problem is that when Matlab calculates this function, it expands the square root at the bottom and converts the coefficients in the denominator into integers and these integers are huge...like 20 digits, which obviously is not desirable.

    As a result, I get this error -

    -----------------------------------
    >> solve (2)

    func =

    (-1/3*x-1/3*y+1)/(x^2-2*x+2+y^2-2*y)^(1/2)

    Warning: Explicit integral could not be found.
    > In C:\MATLAB6p5\toolbox\symbolic\@sym\int.m at line 58
    In C:\MATLAB6p5\work\new code\inner_solution.m at line 86
    In C:\MATLAB6p5\work\new code\solve.m at line 68

    func =

    2251799813685248*(-1/3*x-1/3*y+1)/(5070602400912917605986812821504*x^2-14582283837457116980758875996160*x+13577279319312600561526669902626+5070602400912917605986812821504*y^2-7920665284010178564982304669696*y)^(1/2)

    Warning: Explicit integral could not be found.
    > In C:\MATLAB6p5\toolbox\symbolic\@sym\int.m at line 58
    In C:\MATLAB6p5\work\new code\inner_solution.m at line 86
    In C:\MATLAB6p5\work\new code\solve.m at line 68
    K>>

    -----------------------------------

    If you look at the big function above, you can see that if the denominator is divided by the first constant term ( in the beginning of the expression multiplying the numerator) , we get the normal small expression with decimal numbers.

    Also, x and y are symbols...declared like this -

    syms x;
    syms y;

    Anyone know how to solve this problem? Like there has to be a way to supress this thing in Matlab.

    Thanks a lot in advance for help.
     
Thread Status:
Not open for further replies.

Share This Page