The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 how to set matrix values?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

circumvent

Posts

Posted - 07/29/2009 :  10:06:27 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I want to plot a cut 3D surface, for example z=x^2+y^2, plot the range from -10 to 10 for x and y

Now I create a new matrix, set dimentions, x and y cooridinates from -10 to 10, then I set value, cell(i,j)=x^2+y^2.Everything works.


Next I only want to plot half of the data, for example, only x>y+1. So I get the script Windows out. I understand that I should make a i and j loop to call cell(i,j). But how should I assign the x, y values to the Matrix?
The idea should be
loop (ii,1,32)
{
loop (jj,1,32)
{
if (x>y+1) z=x^2+y^2.
else z=0.



}
}

Thanks.

larry_lan

China
Posts

Posted - 08/03/2009 :  10:47:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi:

You can create an Origin C function like:

double setmatrixvalue(double x, double y)
{
	if (x>y+1)
	{
		return x^2+y^2;
	} else
	{
		return 0;
	}
}


And Call this function in Set Matrix Value like

Cell(i, j) = setmatrixvalue(i, j)


Thanks
Larry
OriginLab Technical Services
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000