cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

SOLVED

## Re: Shows variable is undefined

Thank you. My work involves to do a cubic spline interpolation. Should I try with a cubic spline and then use interpolation or, there is a smarter way.

## Re: Shows variable is undefined

Prime has (among many) a cubic spline function (cspline.)  It will create a function that is an interpolation between knots.

## Re: Shows variable is undefined

Thank you very much. Should I use as interp(cspline(x,y),x,y,x1)

## Re: Shows variable is undefined

@fahmed-2 wrote:

Thank you. My work involves to do a cubic spline interpolation.

You never mentioned that you will be after interpolation so far

Should I try with a cubic spline and then use interpolation or, there is a smarter way.

The spline already IS an interpolation!

There is not much you'll have to change if you want to replace my linear interpolation by spline interpolation.

You also may want to know that Mathcad knows three different types of cubic splines (the difference is the behaviour at the end points).

## Re: Shows variable is undefined

Thank you very much for your email. My work has many pieces and parts and I am going one by one and approaching it. I have been working for almost 3 hours with this problem and might take some more time also. I myself also am trying to come up with various approaches and I truly appreciate your help towards my concern.

Highlighted

## Re: Shows variable is undefined

Is there a way to get the absolute values of a vector. I know the scalar part.

## Re: Shows variable is undefined

One way to do it:

## Re: Shows variable is undefined

You used try-error statement and mentioned as trying the absolute if not then just return the value. What does this logic signify. And finally, you vectorized the whole to make the output. Can you please tell me why was it done like this. Thank you

## Re: Shows variable is undefined

Try and catch was used because your matrix contains a cell with a text (upper left) which would otherwise throw an error when the absolute value is applied.

Vectorization is always the thing to do when you apply calculations on a vector or matrix which is supposed to work not on the whole vector/matrix but on every single element of it. In case of this example you could omit the explicit vectorization because Mathcad will apply automatic vectorization anyway but its a good idea to ALWAYS use explicit vectorization when you want it to be done and don't rely an Mathcads automatic one.