Author |
Topic  |
|
strain17
USA
Posts |
Posted - 11/17/2003 : 4:41:02 PM
|
Hi, I was wondering how you could plot 3D funtions in Origin. Lets say for example a sphere, z^2=x^2+y^2. Or if I have a function of Z in terms of sin(x) and sin(y), how would I plot that ? I tried setting my values in a matrix as z = (x^2+y^2)^(1/2). It gave me this error:
Error, Variable "(i" not declared Error, general compile error Error, error(s) found in compiling function _MatrixSetValuesFromXYIJ
Any help would be greatly appreciated. Thanks. |
|
easwar
USA
1965 Posts |
Posted - 11/17/2003 : 9:16:50 PM
|
Hi,
Looks like you are using Orign version 7 or higher, and have the "Compile as Origin C and treat x^y as pow(x,y)" checkbox checked in the Set Matrix Values dialog box. Checking this box results in much faster computation of the matrix values, but the expression needs to be ANSI C compatible.
I am not sure how you got the Error, Variable "(i" not declared message, since your expression does now have any "i" in it. Did you enter the expression: (x^2+y^2)^(1/2). with a period at the end of the expression? You will then get the error: Error, Variable "(1/2)." not declared If this is what you got, you need to remove the period, and just enter: (x^2+y^2)^0.5 Note that I used 0.5 instead of (1/2). In C, (1/2) = 0 because this is treated as integer division, and so your expression for z will be equal to 1 at all x and y values. You need to enter fractions as (1.0/2) or (1/2.0) etc. to get the floating point value you desire.
Now, Origin matrices currently support only single-valued z(x,y) functions and so you cannot plot a sphere with just one matrix.
Easwar OriginLab.
|
 |
|
Mike Buess
USA
3037 Posts |
|
strain17
USA
Posts |
Posted - 11/19/2003 : 01:05:17 AM
|
Mike and easwar, Thanks for the feedback. It helped me.
easwar, Sorry for not explaining. The error should be: Error, Variable "(x" not declared Error, general compile error Error, error(s) found in compiling function _MatrixSetValuesFromXYIJ
I had changed the "x" in the equation to an "i" after I saw the error. As you can see, same error occurs. I wonder why. |
 |
|
cpyang
USA
1406 Posts |
Posted - 11/19/2003 : 2:51:29 PM
|
You will need to put variables x, y etc into lower case.
Also, you can use
sqrt(x^2+y^2)
CP
|
 |
|
|
Topic  |
|
|
|