MATLAB: Correction of XYZ data with Interpolation

interp1interp2interpolationMATLAB

Hey Guys,
I have some XYZ Data, where X and Y are my coordinates and Z the value of each. I get them from a CSV-File, where i fetch the interesting three column. I can print them with delaunay(X,Y) and trisurf(X,Y,Z). This works fine.
However, in the simulation, where the CSV-File is created, is something wrong. So i have false Z-Values in my Data.
Is there any way to interpolate this?
Unbenannt.JPG
This is a snapshot from the plot, so that you see what i mean.
I think that interp2 could be the right function, but i am not sure how to use it properly and everything I tried made it even worse.
Cheers and thanks in regards!

Best Answer

Sorry, but you have a few misconceptions here.
  1. Interp2 is not an outlier detection algorithm. (What you need for something like this.)
  2. Interp2 does not work on scattered data. And if you needed to use a delaunay triangulation (x,y) and then trisurf, then your data is scattered.
  3. You cannot use an interpolation scheme if you have outliers. Worse, it looks like you have a lot of outliers in that data. That makes it difficult, even for tools that can try to detect outliers.
I would recommend that you think about what characterizes these outliers. Do they all have the same z value? That looks to be true from the plot. If so, then just search for that value, and delete those points as garbage. They cannot be used. Once the garbage is deleted, then you can use the interpolation tools you have found, although interp2 would still be completely, totally inappropriate. Better yet would be a tool like scatteredInterpolant, which allows you to avoid theneed for a trinagulation done by yourself. And if offers smoother interpolation methods than linear.