Skip to content

Problem with interpolation #482

Closed Answered by Proektsoftbg
MohamedMostafaShehata asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @MohamedMostafaShehata! Nice to see you on GitHub!

Yes, they are discrete values, but Calcpad includes linear and spline interpolation functions: line(x; y_values) and spline(x; y_values), respectively. You have to put your data instead of y_values and it will become a continuous function.
You should do that for both Re and Cd by defining the functions:
Re_lin(x) = line(x; Re)
Cd_lin(x) = line(x; Cd)
'Then, find x for your Reinolds number Re0 = 27000' by using the following command
x0 = $Find{Re_lin(x) - Re0 @ x = 1 : len(Re)}
'And finally extract the corresponding Cd value
Cd0 = Cd_lin(x0)

Below is the complete working code you can use:

'Reinold′s values
Re = [11366.13396; _
12467.44…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by MohamedMostafaShehata
Comment options

You must be logged in to vote
1 reply
@Proektsoftbg
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants