Function

Function - Сообщения

#1 Опубликовано: 24.01.2012 02:15:46
Shiwani Thakur

Shiwani Thakur

0 сообщений из 7 понравились пользователям.

Группа: User

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?
#2 Опубликовано: 24.01.2012 03:34:33
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello,

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 Опубликовано: 24.01.2012 05:41:42
Shiwani Thakur

Shiwani Thakur

0 сообщений из 7 понравились пользователям.

Группа: User

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.
#4 Опубликовано: 24.01.2012 09:50:55
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

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
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#5 Опубликовано: 27.01.2012 05:37:45
Shiwani Thakur

Shiwani Thakur

0 сообщений из 7 понравились пользователям.

Группа: User

Thanks again. It is helpful.
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений