Interpolation within a 3d array

조회 수: 4 (최근 30일)
Charles
Charles 2011년 2월 28일
I have a function of the form w=f(x,y,z) so running this function within a range of x,y,z inputs, say 1:3 for each, creates a 3x3x3 array of solutions. Now I want to know when w = 0 so I would like to interpolate within this array to find out what inputs I require to make the function zero.
Thanks for any help.

답변 (1개)

Sarah Wait Zaranek
Sarah Wait Zaranek 2011년 3월 3일
You can probably use a lot of methods to do this, depending on what your function looks like.
If you do not have the optimization toolbox, one way would be to use fminsearch where your objective function would be abs(f(x,y,z));
See code below:
function findFuncZero
[x,feval] = fminsearch(@myFunction,[0 0 0]);
disp(x)
disp(feval)
end
function w = myFunction(inputVar)
x = inputVar(1);
y = inputVar(2);
z = inputVar(3);
w = abs(1* sin(x) + cos(y) + 2*sin(z) + 1);
end
My output is the following:
-0.1461 0.7125 -0.9366
5.0390e-005

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by