Effacer les filtres
Effacer les filtres

Interpolating the y values of a dataset A to correspond to the x values of dataset B.

1 vue (au cours des 30 derniers jours)
Hi,
I have 2 datasets containing the numerical (x1,y1) and experimental (x2,y2) results of a problem that lie within the same limits. I have to obtain the root-mean-square error to show the deviation of the numerical results from the experimental data, but the numerical data points (y1) are recorded on different locations (x1) from those of the experimental data points (x2) due to which the error calculation is not possible.
I'd like to know if there is a precise method to interpolate the y1 values for the locations prescribed in x2.

Réponse acceptée

Torsten
Torsten le 6 Juin 2024
Modifié(e) : Torsten le 6 Juin 2024
The easiest way I can think of is
y1_at_x2 = interp1(x1,y1,x2)
If it's precise ? Define precise. At least you have the choice between different methods of interpolation. Read the documentation of "interp1" for more details.
If the (x1,y1) were obtained by a numerical method, you usually have the choice to define the output points x. Why didn't you choose x2 instead of x1 ?
  4 commentaires
Shadab
Shadab le 6 Juin 2024
Modifié(e) : Shadab le 6 Juin 2024
I have clarified the issue in response to the previous comment. I realize "precise" wasn't the right term to use for what I wanted to ask, for which I apologize. I wanted to ask if such interpolation could be achieved consicely or would it be possible using a series of commands.
Torsten
Torsten le 6 Juin 2024
You need one command
y1_at_x2 = interp1(x1,y1,x2,method)
in which you should test for different interpolation methods available.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by