Skip to main content
12-Amethyst
September 5, 2011
Question

expanding linterp() and Origin

  • September 5, 2011
  • 19 replies
  • 6742 views

The linterp() function fails where there are vertical lines, so I have added Linterp() to assign values at vertical lines.

I use this often as I describe shapes for wind, soil, variable depth sections etc., Then I can numerically integrate or whatever.

However, I always use ORIGIN=1. My programs, such as this one, are constructed in reference files and the matrices in the argument list are created in the main file.

As Valery has noted, general programs should be independent of the ORIGIN.

But, in general, the origin for the program and the matrices in the argument list may be different. I can include ORIGIN in the argument list easy enough, but I would rather not. So I need to be able to determine the origin of the input matrices inside the program. But, I don't see any functions that I can use directly. I could append something (a string perhaps) and find its indices an thus determine the origin, but is there a simple and direct way to do this?

19 replies

1-Visitor
September 5, 2011

Something like the attached?

Clipboard01.jpg

Mike

wayne12-AmethystAuthor
12-Amethyst
September 5, 2011

Hi Mike,

Something like that, Thought about that, but when I have a matrix, I cant use last(). So I could select the <1> column because I would always have that column if I had a matrix and not a vector.

Or, If I wanted to be more general and allow a vector or a matrix (because I am lazy) then I could augment the matrix with itslef, then I could do the test also.

But then, what if the matrix is big

So I thought, what abut using "on error" which I think works pretty well, what say you?

PS. normally when I see "error" I start looking for someone to blame, which is hard since I work moslty alone.

wayne12-AmethystAuthor
12-Amethyst
September 5, 2011

Added to allow for vector or matrix