필터 지우기
필터 지우기

2D color or surface plot based on 3 columns of data

조회 수: 10 (최근 30일)
N/A
N/A 2020년 2월 2일
댓글: N/A 2020년 2월 3일
I want to do a 2D plot based on 3 columns of data (X,Y and Z) . X column show positions, y column show speed and z column show emissions. I guess first I should make meshgrid between x and y then show the z values on this 2D plot. I want to have a result like the bottom of this image. So the result will shows emissions as colors on x(position)-y(speed) axis. Can somebody help me about this?
images.jpg

채택된 답변

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2020년 2월 2일
Ideally you should have a perfect grid and them you can do this kind of plot. In your case, however, you have only scattered values and some grid points are outside your domain, which means that to plot the whole domain you would have to extrapolate the data and even get very wrong results.
A better solution is to interpolate only between the points you have and then plot the result. You can do this by first triangulating the points and the use the trisurf function to do the plot. An example code can be seen below:
A = xlsread('LMS.xlsx');
T = delaunay(A(:,1),A(:,2)); % Triangulation
trisurf(T,A(:,1),A(:,2),A(:,3))
xlabel('x')
ylabel('y')
colorbar
shading interp
view(2)
Untitled.png
  댓글 수: 1
N/A
N/A 2020년 2월 3일
Thanks for your help. But I want to show also X-V relationship while I'm showing emissions as a colour scale. So I need this image with colour of z value (emissions)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by