Interpolate between columns within matrix to remove glitched data

1 visualizzazione (ultimi 30 giorni)
Hi, I have a complex matrix where some colums contain glitched data. If columns 25,26 contains glitched data, how can I interpolate between the data in columns 24 and 27 in order to replace columns 25 and 26 within the matrix with the interpolated data?
Thanks
  1 Commento
Mathieu NOE
Mathieu NOE il 26 Ott 2022
hello
have you tried with
if your situation needs more than this advice maybe you should share the data / code that goes along to shw the issue(s)

Accedi per commentare.

Risposta accettata

Voss
Voss il 26 Ott 2022
% a random matrix with 27 columns:
data = rand(10,27);
% glitch columns 25 and 26:
data(:,[25 26]) = NaN;
% show columns 24 to 27 for reference:
data(:,24:27)
ans = 10×4
0.1028 NaN NaN 0.4775 0.1076 NaN NaN 0.9803 0.5539 NaN NaN 0.5751 0.0611 NaN NaN 0.6417 0.9991 NaN NaN 0.8661 0.3203 NaN NaN 0.6451 0.8962 NaN NaN 0.5333 0.5412 NaN NaN 0.8923 0.7979 NaN NaN 0.2805 0.3862 NaN NaN 0.7574
% interpolate based on columns 24 and 27 to get new values for columns 25 and 26:
data(:,[25 26]) = interp1([1 4],data(:,[24 27]).',[2 3]).';
% show new columns 24 to 27:
data(:,24:27)
ans = 10×4
0.1028 0.2277 0.3526 0.4775 0.1076 0.3985 0.6894 0.9803 0.5539 0.5609 0.5680 0.5751 0.0611 0.2546 0.4482 0.6417 0.9991 0.9547 0.9104 0.8661 0.3203 0.4286 0.5368 0.6451 0.8962 0.7752 0.6543 0.5333 0.5412 0.6582 0.7753 0.8923 0.7979 0.6254 0.4529 0.2805 0.3862 0.5100 0.6337 0.7574

Più risposte (0)

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by