1
$\begingroup$

I have a set of data like:

matrix=Table[{x,y,x+y*c1},{x,0,1,0.1},{y,0,1,0.1}]

where 'c1' is a real constant. I'm trying to create an interpolation function called 'fun' like:

fun=Interpolation[matrix,Method->"Spline"]

It obviously creates a little problem beacuse 'c1' has not a numeric values. My question: is it possible to create an interpolation function with a non-numeric constant, like 'c1' in the previously case?

Thanks for any tips and helps!

$\endgroup$

1 Answer 1

1
$\begingroup$
Clear["Global`*"]

The Interpolation data needs to be structured as {{x1, y1}, f1}, {x2, y2}, f2}, ...}

data = Flatten[Table[{{x, y}, x + y*c1}, {x, 0, 1, 0.1}, {y, 0, 1, 0.1}], 1];

f[c1_] = Interpolation[data]

enter image description here

Manipulate[
 Plot3D[f[c1][x, y], {x, 0, 1}, {y, 0, 1}],
 {{c1, 1}, 0, 10, 0.1, Appearance -> "Labeled"}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.