How to plot the figure with 3 variables in 2d, with the value of z is proportional to the color?

조회 수: 26 (최근 30일)
Dear Friends
I would like to plot the figure with 3 variables in 2d, with the value of z is proportional to the color as the figure attached. where X(1 x N); Y(1 x N) and Z(N*N) matrix. I want to have a scatter plot as an attached figure. Thank you for your attention
Code
load('w.mat');load('k.mat');load('Detal_E.mat');
w0=6.266963343377698e+05;
[X,Y] = meshgrid(w/w0,k);
h=surf(X, Y,Detal_E*1e6);
xlabel('w')
ylabel(' k')
zlabel('Detal E')
myColorMap = jet(250);
myColorMap(1,:) = 1;
colormap(myColorMap);
colorbar
shading interp;
view(2)

채택된 답변

David Hill
David Hill 2021년 4월 2일
m=min(Detal_E);
M=max(Detal_E);
c=(Detal_E-m)/(M-m)*9+1;
scatter(X,Y,25,c,'filled');
  댓글 수: 3
David Hill
David Hill 2021년 4월 5일
load('w.mat');load('k.mat');load('Detal_E.mat');
w0=6.266963343377698e+05;
[X,Y] = meshgrid(w/w0,k);
m=min(Detal_E,[],'all');
M=max(Detal_E,[],'all');
c=(Detal_E-m)/(M-m)*9+1;
scatter(X(:),Y(:),5,c(:),'filled');
Tin Truong Chanh
Tin Truong Chanh 2021년 4월 5일
This code matches well with my problem. Thank you so much for your help!

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

추가 답변 (1개)

Fatima
Fatima 2024년 5월 7일
편집: Fatima 2024년 5월 7일
How to plot system of three linear equations in three variables in MATLAB

카테고리

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