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
 interpolation

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
couturier Posted - 11/06/2017 : 11:28:21 AM
Origin Ver. and Service Release (Select Help-->About Origin): 2017SR2
Operating System:win10

Hi,

I'm trying to find the LT copy -s equivalent operation in OriginC:
I have a vector with N1 pts, and I'd like this vector to become N2 pts, without the need of specifying an input and output X vector.

Thanks for your help
4   L A T E S T    R E P L I E S    (Newest First)
couturier Posted - 11/10/2017 : 3:03:19 PM
No problem at all.
I asked in case I had missed some OC function, allowing faster execution
quote:
vectorbase::Data() behaves in a way quite strange

What do you mean ?
never had any issue
Castiel Posted - 11/08/2017 : 08:24:42 AM
quote:
Originally posted by couturier

Thanks a lot Castiel.
I was just wondering if I could avoid that step of creating X values.



Why? Does creating X data raise any problem?

vectorbase::Data() behaves in a way quite strange comparing to python or matlab which however has been carefully handled.


     #####
    #### _\_  ________
    ##=-[.].]| \      
    #(    _\ |  |------|
     #   __| |  ||||||||
      \  _/  |  ||||||||
   .--'--'-. |  | ____ |
  / __      `|__|[o__o]|
_(____nm_______ /____\____ 
couturier Posted - 11/07/2017 : 02:48:37 AM
Thanks a lot Castiel.
I was just wondering if I could avoid that step of creating X values.
Castiel Posted - 11/06/2017 : 10:43:59 PM
quote:
Originally posted by couturier

Origin Ver. and Service Release (Select Help-->About Origin): 2017SR2
Operating System:win10

Hi,

I'm trying to find the LT copy -s equivalent operation in OriginC:
I have a vector with N1 pts, and I'd like this vector to become N2 pts, without the need of specifying an input and output X vector.

Thanks for your help




Simply apply the linear interpolation to your data.

bool lt_copy_s(vector<double>& values, size_t npts)
{
    size_t nSrcSize = values.GetSize();
    vector<double> SrcX;
    SrcX.Data(0.0, nSrcSize - 1, 1.0);

    vector<double> X, Y;
    double delta = (values.GetSize() - 1.0) / (npts - 1.0);
    X.Data(0.0, values.GetSize() - 1, delta);
    Y.SetSize(X.GetSize());

    int nRet = ocmath_interpolate(X, Y, npts, SrcX, values, nSrcSize);
    if(nRet != OE_NOERROR)
        return false;
    values = Y;

    return true;
}




     #####
    #### _\_  ________
    ##=-[.].]| \      
    #(    _\ |  |------|
     #   __| |  ||||||||
      \  _/  |  ||||||||
   .--'--'-. |  | ____ |
  / __      `|__|[o__o]|
_(____nm_______ /____\____ 

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