Interpolate data to present with limited size of data

2 views (last 30 days)
Suppose I only have 35 data points, it is very expensive to run.
x=rand(5,7)
figure
imagesc(x)
axisx=[11 12 13 14 15 16 17]
axisy=[10 20 30 40 50]
Is there any way to present them smoother, using imagesc gives too pixel. Is there any interpolation?
and display the axis with my axisx and axisy

Accepted Answer

Davide Masiello
Davide Masiello on 2 Nov 2022
x=rand(5,7)
x = 5×7
0.2207 0.4751 0.9818 0.6898 0.8489 0.7640 0.3894 0.1370 0.3264 0.7110 0.4195 0.6313 0.4999 0.0168 0.9267 0.9988 0.6922 0.3023 0.1398 0.5576 0.8856 0.2924 0.5511 0.0081 0.9578 0.6766 0.4339 0.1714 0.5717 0.5432 0.3209 0.2490 0.3414 0.1640 0.6649
figure
contourf(x,'LineColor','none')
shading interp
axis equal off
  4 Comments
Miraboreasu
Miraboreasu on 2 Nov 2022
Edited: Miraboreasu on 2 Nov 2022
Thank you, I think I need to rephase my quesiton, but I don't if I need to post a new thread, I will ask here first.
So for this matrix,
x=rand(5,7)
each row is one variable changing
axisx=[11 12 13 14 15 16 17]
each column is another variable changing
axisy=[10 20 30 40 50]
the value of the matrix like x(1,2) is what I want to show in colorbar
What is the best way to present them? with axis
Davide Masiello
Davide Masiello on 2 Nov 2022
Edited: Davide Masiello on 2 Nov 2022
axisx = [11 12 13 14 15 16 17];
axisy = [10 20 30 40 50];
[x,y] = meshgrid(axisx,axisy);
z = rand(5,7);
[x_new,y_new] = meshgrid(linspace(axisx(1),axisx(end),100),linspace(axisy(1),axisy(end),100));
z_new = interp2(x,y,z,x_new,y_new);
contourf(x_new,y_new,z_new,linspace(min(z(:)),max(z(:)),100),'LineColor','none')
shading interp
colorbar
xlabel('x axis')
ylabel('y axis')

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!