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 for Programming
 LabTalk Forum
 Subtract plane from matrix data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

white.string

Germany
Posts

Posted - 04/11/2005 :  02:34:28 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version: 7.5G SR 3
Operating System: Windows XP

Hi,

to correct a matrix of (topographic) data to a base plane I've used the 3-point method to determine the plane, generate a new matrix of same dimension and subtract these matrix from the matrix of raw data. I've got two questions:

A) For automated processing I use 3 fixed Points. But in case of spikes the result could be quite poor. So I'd like to use a linear fitting procedure using one row and one column of the raw data. The procedure would be something like

lr data_1b

This requires to copy the data of the desired row and column into a temporary dataset. Is there a way to avoid this, i.e. to operate directly on a row or column?

B) Until now I calculate the corrected matrix by subtracting "cell-by-cell" like this:

loop(ii,1,nRow)
{
loop(jj,1,nCol)
{
%Q!cell(ii,jj)=%M!cell(ii,jj)-%A!cell(ii,jj);
};
};


where %M is the original dataset and %A is the matrix of the calculated plane. The performance on large matrices (i.e. 500x500 data) is rather poor. Is there a more elegant way in LabTalk for this job something like Matrix3 = Matrix1 - Matrix2 ?

Thanks for any comments!
Rolf

Mike Buess

USA
3037 Posts

Posted - 04/11/2005 :  07:36:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Rolf,

A) LabTalk has no method for operating on a single matrix row or column. The easiest way to operate on a column is to convert to wks, operate on desired column and convert back to matrix if necessary. To operate on a row just transpose the matrix first.

B) Matrix3 = Matrix2 - Matrix1 works if all matrices have the same size.

Mike Buess
Origin WebRing Member
Go to Top of Page

white.string

Germany
Posts

Posted - 04/11/2005 :  11:03:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Mike, you're always here when somebody needs help. Just great!

According B) there is still a question for me: I can do the calculation saying Matrix3=Matrix2-Matrix1 in the script window. But how can I do that using String variables?

%Q=Matrix3;
%R=Matrix2;
%S=Matrix1;

%Q=%R-%S;

apparently doesn't work (I didn't expect this). What would be the proper notation to access matrices through variables?

Thanks a lot!
Rolf
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 04/11/2005 :  12:10:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Rolf,

%Q=%R-%S is a string operation to LabTalk...

%Q=%R-%S;
%Q=;
matrix2-matrix1

Put the LHS in parentheses to force an arithmetic operation...

(%Q)=%R-%S;
%Q=;
matrix3

...I should add that matrices are much more easily manipulated in Origin C than in LabTalk.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 04/11/2005 12:18:08 PM
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