Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

[Power Operator (^)]

mat(2)^3;
#//Calculate the cube of a matrix
wks.nmats=2;
msetvalue im:=mat(2) formula:="x";

[Conditional Operator (?:)]


mat(2)<0?1/0:mat(2);
#//Fill missing values outside the circle
wks.nmats=2;
mdim cols:=41 rows:=41 x1:=-10 x2:=10 y1:=-10 y2:=10;
msetvalue im:=mat(2) formula:="64-(x^2+y^2)";

[OriginSeparator1]

[2D Gaussian Surface]


nlf_Gauss2D(x,y,0,1,5,2,5,2)

[Mexican Hat]
sin(sqrt(x^2+y^2))/sqrt(x^2+y^2);
#//Set values of XY coordinates for the matrix
mdim cols:=41 rows:=41 x1:=-10 x2:=10 y1:=-10 y2:=10;

[Paraboloid]
x^2/4;
#//Create matrix objects for X and Y
wks.nmats=3;
mdim cols:=51 rows:=51 x1:=0 x2:=10 y1:=0 y2:=2*pi;
msetvalue im:=mat(2) formula:="x*cos(y)";
msetvalue im:=mat(3) formula:="x*sin(y)";

[Plane]
nlf_Plane(x,y,-1,1,1)

[Sphere]
cos(x);
#//Create matrix objects for X and Y
wks.nmats=3;
mdim cols:=50 rows:=50 x1:=0 x2:=pi y1:=0 y2:=2*pi;
msetvalue im:=mat(2) formula:="sin(x)*cos(y)";
msetvalue im:=mat(3) formula:="sin(x)*sin(y)";

[OriginSeparator2]

[Matrix Object Range: Adding Two Matrix Objects]


mat(2)+mat(3);
#//Prepare two extra objects in the matrix sheet
wks.nmats=3;
msetvalue im:=mat(2) formula:="x";
msetvalue im:=mat(3) formula:="y";

[Calculation between Matrix Objects in Another MSheet]


ma*mb;
#//Prepare two extra objects in another matrix sheet
newbook mat:=1;
%A=bkname$;
range m1=[%A]1!;
m1.nmats=2;
range ma=[%A]1!mat(1);
range mb=[%A]1!mat(2);
msetvalue im:=ma formula:="sin(x+y)";
msetvalue im:=mb formula:="cos(x+y)";

[Fill the Matrix with Uniform Random Numbers]


rnd()

[Using X-Function: Normalize the Matrix to (0,1)]


(cell(i,j)-dmin)/(dmax-dmin);
#//Calculate descriptive statistics on the matrix
mstats min:=dmin max:=dmax;

You might also like