find the interpolation of two values.

2 vues (au cours des 30 derniers jours)
solleti prabhakarchary
solleti prabhakarchary le 8 Oct 2022
how to find values for this data in between
6 1.256 1.365 0.358 2.589 2.365 2.365 2.456
8 3.250 3.255 3.62 1.25 1.256 2.321 3.214
i would like to find values for 6.5, 7, 7.5 using matlab. which command need to be used please help me in this code.

Réponse acceptée

Image Analyst
Image Analyst le 8 Oct 2022
See if this is what you want. You can use linspace to make the 2 rows into 5 rows:
m = [...
6 1.256 1.365 0.358 2.589 2.365 2.365 2.456
8 3.250 3.255 3.62 1.25 1.256 2.321 3.214];
[rows, columns] = size(m);
m2 = zeros(rows + 3, columns);
for col = 1 : size(m, 2)
m2(:, col) = linspace(m(1, col), m(2, col), 5);
end
m2
m2 = 5×8
6.0000 1.2560 1.3650 0.3580 2.5890 2.3650 2.3650 2.4560 6.5000 1.7545 1.8375 1.1735 2.2542 2.0878 2.3540 2.6455 7.0000 2.2530 2.3100 1.9890 1.9195 1.8105 2.3430 2.8350 7.5000 2.7515 2.7825 2.8045 1.5848 1.5333 2.3320 3.0245 8.0000 3.2500 3.2550 3.6200 1.2500 1.2560 2.3210 3.2140

Plus de réponses (1)

Ghazwan
Ghazwan le 8 Oct 2022
You need to have X and Y vector arrays. The X values need to incapsulate the requested points. You may use interp1 fucntion. For example:
X=[6 1.256 10 ];
Y=[8 3.250 8.5 ];
Ynew = interp1(X,Y,[6.5, 7, 7.5])

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by