I want to fill in the gaps in a matrix (extrapolation) and produce nice looking plots such as this ->
Show older comments
I have a plot attached (17.02.17) which was created using vectors and interpolation via binning (bindata2: http://xcorr.net/2013/12/23/fast-1d-and-2d-data-binning-in-matlab/). However, I want to create a nicer looking plot so that the image looks more smoother / higher definition (see higher def plot (17.13.33)- I didn't create).
Can someone tell me how I can do this via extrapolation (to fill in the gaps - if possible) i.e. to guess values where there are none? and also, which plotting functions are the nicest? at the moment, I'm only using imagesc and pcolor. Are there any better Matlab / external toolbox plotting functions that anyone knows of?
Here's some example code of where I am at the moment:
for d = 1:10;
val(d).field = data_split(d).SG.field;
val(d).y = data_split(d).SG.y;
val(d).x = data_split(d).SG.x;
end
x = [val(:).x];
y = [val(:).y];
field = [val(:).field];
x1rg = [7:0.020:9];
x2rg = [0:5:1000];
Output = bindata2(...
[field],... % Value to grid
[x],[y],... %x1 and x2 in the script, or your x and y locations in more general terms
x1rg,x2rg);
figure;
pcolor(x1rg(1:100),x2rg(1:200),Output);
shading flat;
colorbar
caxis([8 8.3]);
xlim([7.2 8.3]);
title('title','fontsize',22);
ylabel('y');
set(gca,'FontSize',16);
set(gca,'ydir','reverse')
Accepted Answer
More Answers (1)
Adam
on 22 Jun 2015
doc interp2
should do the job. There are examples on that page - it isn't totally intuitive to use first time. It is what I use for this kind of thing usually. I also use imagesc for plotting, I've never used pcolor not especially knew it existed so not sure what that does differently!
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!