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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 smooth

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ovince Posted - 01/10/2007 : 02:55:52 AM
hi,

Happy New Year first of all to everybody :)))))

I tryed to smooth curve like this:

Curve crv(wksNew, 0, 1);
BOOL bErr = smooth(crv, 0, 100, 100);

int k = gly.AddPlot( crv, IDM_PLOT_LINE );
DataPlot dpLine = gly.DataPlots(k);
dpLine.Curve.Line.Color.nVal = k;

gly.Rescale();

This should adjecent average taking 200 points into accout. Have any idea why result obtained in this way differ from the result I get in Origin using Analysis/Smoothing/Adjecent Averaging option?

thanks
regards
oliver
4   L A T E S T    R E P L I E S    (Newest First)
zachary_origin Posted - 02/26/2007 : 9:57:08 PM
Hi Francis,

Other than what Mike has mentioned, I want to supplement something else: avoiding to use Column for a Dataset as class Column object is primarily used for style related control of the data in the associated Dataset. To do the calculation for the columns, you need use Dataset for the column, which merely contains the data of the columns.

You can try to replace the keyword "Column" with "Dataset" in your code, it will work fine.



Zachary
OriginLab Technical Services.



Edited by - zachary_origin on 02/26/2007 9:58:04 PM
Mike Buess Posted - 02/21/2007 : 09:27:12 AM
Hi Francis,

The problem is that col_avg=coly does not copy the values from coly to col_avg. Try this...

Worksheet wks = Project.ActiveLayer();
int icolavg = wks.AddCol("avg");
Curve crvy(wks,1);
Curve crvavg(wks,icolavg);
crvavg = crvy;
BOOL bErr=smooth(crvavg,2,10);

...Also, when 2nd argument is 2 Savitzky-Golay filtering is used rather than Adj Averaging. In that case all arguments are used and your command is equivalent to smooth(crvavg,2,10,3,2). That is, left points = 10, right points = 3, polynomial degree = 2. Is that what you want?

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 02/21/2007 11:12:39 AM
ftalbot Posted - 02/21/2007 : 03:53:03 AM
Hi,
I also have a problem with that "smooth" command.
I use Origin 7.5 SR6 on WinXP+SP2.
Here is a part of my code:
....
icolavg = wks.AddCol("avg");
Column col_avg(wks, icolavg);
Column coly(wks, 1);
col_avg=coly;
Curve crv(wks,icolavg);
BOOL bErr=smooth(crv,2,10);
....
Where I'm trying to add a new column to the worksheet with a smoothed version (I call it "avg") of my data column.
It compiles fine but when I execute the thing I get:
"Origin C Function Runtime Error, LabTalk command failed"
And it refers to my line:
"BOOL bErr=smooth(crv,2,10);"
So, even if I follow the corrected syntax, it still doesn't work.
Am I doing something wrong?
What is the CORRECT syntax for that command?

Francis.
Mike Buess Posted - 01/10/2007 : 07:27:42 AM
Hi Oliver,

The Origin C smooth settings are somewhat misleading. For adjacent averaging the first point argument is actually the total number of points used for averaging and the second argument is ignored. So smooth(crv,0,100,100) takes a total of 100 (actually 101) points into account.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/10/2007 07:28:55 AM

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000