I need a picture of a graph similar to the one I posted

2 次查看(过去 30 天)
clear all
clc
T = readtable('data1.xlsx') ;
T = table2array(T) ;
x = T(1,2:end); %
y = T(2:end,1); %
Z = T(2:end,2:end); % use fillmissing to fill NaNs
[X,Y] = meshgrid(x,y) ;
[xq,yq] = meshgrid(2:0.1:10); % grid 0.1
Zq = interp2(x,y,Z,xq,yq,'spline'); % spline
figure
AA = surf(xq,yq,Zq);
title('(spline,cubic,makima) Interpolation Using Finer Grid');
I need a graph that changes this graph to the following shape, regardless of the exact value.
Of course the overall shape should be the same

回答(1 个)

Star Strider
Star Strider 2021-11-10
Add these calls after the surf call —
colormap(turbo)
shading('interp')
The surf plot should then be close to what appears to be the desired result.
T = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/796594/data1.xlsx') ;
T = 7×9
NaN 2.0000 3.0000 4.0000 6.0000 8.0000 10.0000 12.0000 17.5000 2.0000 0.0070 0.0054 0.0044 0.0039 0.0038 0.0039 0.0040 0.0038 3.0000 0.0073 0.0074 0.0058 0.0044 0.0038 0.0035 0.0036 0.0035 4.0000 0.0076 0.0073 0.0073 0.0053 0.0039 0.0035 0.0032 0.0030 6.0000 0.0070 NaN 0.0069 0.0071 0.0051 0.0039 0.0030 0.0023 8.0000 0.0064 NaN 0.0064 0.0063 0.0062 0.0047 0.0034 0.0018 10.0000 0.0057 NaN 0.0058 0.0057 0.0059 0.0058 0.0043 0.0018
% T = table2array(T) ;
x = T(1,2:end); %
y = T(2:end,1); %
Z = T(2:end,2:end); % use fillmissing to fill NaNs
[X,Y] = meshgrid(x,y) ;
[xq,yq] = meshgrid(2:0.1:10); % grid 0.1
Zq = interp2(x,y,Z,xq,yq,'spline'); % spline
Warning: Columns of data containing NaN values have been ignored during interpolation.
figure
AA = surf(xq,yq,Zq);
colormap(turbo)
shading('interp')
title('(spline,cubic,makima) Interpolation Using Finer Grid');
See the documnetation on the shading function for more information.
.

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by