1 Pages (5 items)
Function - Messages
#1 Posted: 1/24/2012 2:15:46 AM
How to get spline in SMath? Which function can be used for spline?
cinterp function has only three in built arguments. Is it possible to add more arguments? If yes how to add?
cinterp function has only three in built arguments. Is it possible to add more arguments? If yes how to add?
#2 Posted: 1/24/2012 3:34:33 AM
Hello,
Look at this link splines, please.
Do not understand what additional arguments do you need, sorry.
Regards,
Radovan
Look at this link splines, please.
Do not understand what additional arguments do you need, sorry.
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#3 Posted: 1/24/2012 5:41:42 AM
Thanks Radovan.
Let me explain you my question with example
Suppose i have to write as shown below
K(x):= interp(c1,X,Y,x)
I can write it as
K(x):= interp(c1,X,Y)
but i am not able to add the last argument x. How can i add that in interp or cinterp function?
Regards,
Shiwani.
Let me explain you my question with example
Suppose i have to write as shown below
K(x):= interp(c1,X,Y,x)
I can write it as
K(x):= interp(c1,X,Y)
but i am not able to add the last argument x. How can i add that in interp or cinterp function?
Regards,
Shiwani.
#4 Posted: 1/24/2012 9:50:55 AM
You are welcome Shiwani,
I hope you understand that those three spline functions use three arguments
1- vector - column matrix (independent var)
2- vector - column matrix (dependent var)
3- scalar - x-value
It will return y-value for the given x-value. Therefore, here is an example
[MATH=eng]X←mat(1,2,3,5,4,1)[/MATH] [MATH=eng]Y←mat(3,4,1,2,4,1)[/MATH]
For the value of X not given in the X vector provided Y vector, cubic spline will give
[MATH=eng]cinterp(X,Y,4)=0.1174[/MATH]
and you MUST define the function this way
[MATH=eng]K(X)←cinterp(X,Y,x)[/MATH]
If you need to pass some parameter to it, just make another function with more arguments (it may have the same name). I just made this up.
[MATH=eng]cinterp(X,Y,x,c)←line(cinterp(c/2*X,c*Y,x),1,1)[/MATH]
[MATH=eng]c←5[/MATH]
[MATH=eng]cinterp(X,Y,4,c)=20.8145[/MATH]
I hope this would help.
Regards,
Radovan
I hope you understand that those three spline functions use three arguments
1- vector - column matrix (independent var)
2- vector - column matrix (dependent var)
3- scalar - x-value
It will return y-value for the given x-value. Therefore, here is an example
[MATH=eng]X←mat(1,2,3,5,4,1)[/MATH] [MATH=eng]Y←mat(3,4,1,2,4,1)[/MATH]
For the value of X not given in the X vector provided Y vector, cubic spline will give
[MATH=eng]cinterp(X,Y,4)=0.1174[/MATH]
and you MUST define the function this way
[MATH=eng]K(X)←cinterp(X,Y,x)[/MATH]
If you need to pass some parameter to it, just make another function with more arguments (it may have the same name). I just made this up.
[MATH=eng]cinterp(X,Y,x,c)←line(cinterp(c/2*X,c*Y,x),1,1)[/MATH]
[MATH=eng]c←5[/MATH]
[MATH=eng]cinterp(X,Y,4,c)=20.8145[/MATH]
I hope this would help.
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#5 Posted: 1/27/2012 5:37:45 AM
Thanks again. It is helpful.
1 Pages (5 items)
-
New Posts
-
No New Posts