griddata not creating a smooth interpolation

8 views (last 30 days)
Alex Raimes
Alex Raimes on 7 Apr 2018
Commented: adeq123 on 11 Oct 2019
I'm trying to create a surface using the following data
I've collected some rough data points, plotted in this figure (contours added for clarity)
However when I use griddata to interpolate and then mesh the values, the result isn't the 'hill shape' you'd expect, instead it is very uneven as seen below (data points in black)
the central section seems very smooth however both sides are a mess. I've tried the curve fitting app within matlab but the result is the same. Below is the code and data used:
Tmod=[50 100 150 175 200 240 245 245 245 245 245 245 245 245 230 200 150 125 110 100 60 50 35 25 20 20 20 20 25 30 50 100 150 200 230 230 230 230 230 230 230 230 200 150 125 100 75 55 50 45 45 45 45 45 70 100 150 185 200 200 200 200 200 200 200 150 100 70 60 55 55 55 55 100 150 165 170 170 165 160 155 150 100 80 75 70 65 90 110 125 130 125 125 115 100 80 75 75 100 ];
wmod=[250 250 400 500 515 1000 1500 2000 2500 3000 3500 4000 4500 5000 5000 5000 5000 5000 5000 4900 4500 4300 4000 3500 3000 2500 2000 1500 1000 500 1000 600 750 1000 1500 2000 2500 3000 3500 4000 4500 4990 4990 4990 4990 4750 4500 4000 3800 3500 3000 2500 2000 1500 1000 950 1000 1500 2000 2500 3000 3500 4000 4500 4980 4980 4500 4000 3500 3000 2500 2000 1500 1400 1200 1500 2000 2500 3000 3500 4000 4100 4000 3500 3000 2500 2000 1500 1500 1500 2000 2500 3000 3500 3500 3000 2500 2000 1600];
nmod=[86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 96 96 96 96 96 96 96 96 96 96 96];
[wq,Tq]=meshgrid(0:45:4500, 0:2.5:250);
nmap=griddata(wmod,Tmod,nmod,wq,Tq);
figure
mesh(wq,Tq,nmap)
Please let me know if anything is unclear - thanks in advance!

Answers (3)

Luke Farrand
Luke Farrand on 7 Apr 2018
Having a similar problem! Would love some help!!

KAE
KAE on 12 Feb 2019
You may want to try an outside function, objmap, which lets you choose how smooth the map is in x and y, and how much error to allow at your measurement locations.
  1 Comment
adeq123
adeq123 on 11 Oct 2019
Do you have any example of how to use that function ? Can't really understand it from documentation.

Sign in to comment.


KSSV
KSSV on 22 Mar 2019
Try scatteredinterpolant.
Tmod=[50 100 150 175 200 240 245 245 245 245 245 245 245 245 230 200 150 125 110 100 60 50 35 25 20 20 20 20 25 30 50 100 150 200 230 230 230 230 230 230 230 230 200 150 125 100 75 55 50 45 45 45 45 45 70 100 150 185 200 200 200 200 200 200 200 150 100 70 60 55 55 55 55 100 150 165 170 170 165 160 155 150 100 80 75 70 65 90 110 125 130 125 125 115 100 80 75 75 100 ];
wmod=[250 250 400 500 515 1000 1500 2000 2500 3000 3500 4000 4500 5000 5000 5000 5000 5000 5000 4900 4500 4300 4000 3500 3000 2500 2000 1500 1000 500 1000 600 750 1000 1500 2000 2500 3000 3500 4000 4500 4990 4990 4990 4990 4750 4500 4000 3800 3500 3000 2500 2000 1500 1000 950 1000 1500 2000 2500 3000 3500 4000 4500 4980 4980 4500 4000 3500 3000 2500 2000 1500 1400 1200 1500 2000 2500 3000 3500 4000 4100 4000 3500 3000 2500 2000 1500 1500 1500 2000 2500 3000 3500 3500 3000 2500 2000 1600];
nmod=[86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 96 96 96 96 96 96 96 96 96 96 96];
[wq,Tq]=meshgrid(0:45:4500, 0:2.5:250);
% nmap=griddata(wmod,Tmod,nmod,wq,Tq);
F = scatteredInterpolant(wmod',Tmod',nmod') ;
nmap = F(wq,Tq) ;
figure
mesh(wq,Tq,nmap)

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!