# 5D-Interpolation of scattered Data

27 views (last 30 days)
Felix Westermann on 28 Oct 2021
Answered: Rishabh Singh on 1 Nov 2021
Hello everyone,
i have the following problem. Several tests were made over certain operating points (Xn). As a result, the measured value (Y) was recorded and stored. Unfortunately, not all operating points could be approached. Therefore, some lines in Y are empty.
As an example, I've attached a simple Excel-File with invented (but logical) values.
My goal is to interpolate between the discrete operating points (Xn).
For Example, my matlab-function should determinate a Y-value for (I think, linear-interpolation should be ok):
X1 = 2.2
X2 = 28
X3 = 180
X4 = 3
Does anyone have an idea how to do that?
Thank you very much!
I am very excited!

Rishabh Singh on 1 Nov 2021
If you want to calculate the value "Y", for any certain combination of { X1, X2, X3,X4 } you can look into linear regression. Also as your data has "NaN" values, you should use remmissing to remove missing values out from your data. Also consider looking into feval for evaluation of function value.
X = cell(4,1);
for i =1:4
X{i} = data(:,i);
end
data = table2array(rmmissing(data));
Y = data(:,5);
mdl = fitlm(data(:,1:4), Y)
output = feval(mdl, 2.2,28,180,3);
The above code is just a simple implementation, you can look into the linear regression documentation for additional information.
Hope this helps.

### Categories

Find more on Interpolation in Help Center and File Exchange

R2020b

### Community Treasure Hunt

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

Start Hunting!