Hello,
Just wanted help with the error in my code to generate a temperature contour plot. Is there something I am missing? Thanks in advance!
The error I am getting is:
This is the code:
x=[20 30 40 50 60 70 80 90 100]; % x-coordinates
y=[20 30 40 50 60 70 80 90 100]; % y-coordinates
T=[80.36 78.57 71.57 67.86 62.5 57.4 53.57 46.43 44.64]; % Temperature °C
% the coordinate system has its origin in the center of the plate
mdl = scatteredInterpolant(x(:), y(:), T(:), 'natural');
xg = linspace(min(x), max(x), 20);
yg = linspace(min(x), max(x), 20);
[Xg, Yg] = meshgrid(xg, yg);
Zg = mdl(Xg, Yg);
contourf(Xg, Yg, Zg, 10);

답변 (1개)

Star Strider
Star Strider 2021년 3월 25일

0 개 추천

The problem are the data, not scatteredInterpolant.
You can see that by plotting:
figure
stem3(x, y, T)
There is no surface, simply a line, so there is no surface to interpolate.

댓글 수: 2

In this case, how can I then manipulate the data to make a 2-D contour plot? Thanks
Star Strider
Star Strider 2021년 3월 25일
Creating any sort of plot that requires a matrix as the dependent variable does not appear to be possible with the available data.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기

태그

질문:

2021년 3월 25일

댓글:

2021년 3월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by