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

조회 수: 2 (최근 30일)
kyungdoo lee
kyungdoo lee 2021년 11월 10일
답변: Star Strider 2021년 11월 10일
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