Contour comparison with same colorbar limits.

Can someone help me to figure out how to edit my coding so that I can compare the contour for this data and other data within the same colorbar limits so that I can see the difference from the pressure distributions.
% Make x-y mesh grid
x = [-4.2195;
-5.7195;
-7.2195;
-8.7195;
-2.7195;
-4.2195;
-5.7195;
-7.2195;
-8.7195;
-1.2195;
-2.7195;
-4.2195;
-5.7195;
-7.2195;
-8.7195];
y = [6.3;
6.3;
6.3;
6.3;
4;
4;
4;
4;
4;
1.7;
1.7;
1.7;
1.7;
1.7;
1.7];
pressure = [0.007102637;
0.006237111;
0.003838996;
0.003957271;
0.010614624;
0.005477081;
0.004232522;
0.004189709;
0.003693549;
0.008519338;
0.005573828;
0.003937382;
0.004821263;
0.004177716;
0.004030966];
[xq,yq] = meshgrid(...
linspace(min(x),max(x),170),...
linspace(min(y),max(y),170));
% Interpolate using "griddata" function
pq = griddata(x,y,pressure,xq,yq,'cubic');
% Visualize the result
figure
surfc(xq,yq,pq)
xlabel('x','FontSize',16)
ylabel('y','FontSize',16)
c = colorbar;
c.Label.String = 'Cp';
c.Label.FontSize = 16;

답변 (2개)

Voss
Voss 2022년 6월 2일
Use clim (a.k.a. caxis):
% Make x-y mesh grid
x = [-4.2195;
-5.7195;
-7.2195;
-8.7195;
-2.7195;
-4.2195;
-5.7195;
-7.2195;
-8.7195;
-1.2195;
-2.7195;
-4.2195;
-5.7195;
-7.2195;
-8.7195];
y = [6.3;
6.3;
6.3;
6.3;
4;
4;
4;
4;
4;
1.7;
1.7;
1.7;
1.7;
1.7;
1.7];
pressure = [0.007102637;
0.006237111;
0.003838996;
0.003957271;
0.010614624;
0.005477081;
0.004232522;
0.004189709;
0.003693549;
0.008519338;
0.005573828;
0.003937382;
0.004821263;
0.004177716;
0.004030966];
[xq,yq] = meshgrid(...
linspace(min(x),max(x),170),...
linspace(min(y),max(y),170));
% Interpolate using "griddata" function
pq = griddata(x,y,pressure,xq,yq,'cubic');
% Visualize the result
figure
surfc(xq,yq,pq)
xlabel('x','FontSize',16)
ylabel('y','FontSize',16)
c = colorbar;
c.Label.String = 'Cp';
c.Label.FontSize = 16;
clim([0 0.015])

댓글 수: 3

Thank you, but if i enter different pressure values, the shade/the contour colour will change according to the current range set?
Voss
Voss 2022년 6월 2일
If you specify some clim, then that's what will be used, regardless of the data.
The default behavior (i.e., without specifying some clim) is for the color-limits to span the data, but I thought that's not what you want in this case, since the colors need to be the same as some other plot you have, in order to compare the two plots.
I want like when component A has pressure value of 100 Pascal, and when component B has 50 Pascal, the pressure distribution/intensity will be higher for A compared to B (if we think logically). So I need a same range let say for A (0 to 100 Pa) and same goes to B (0 to 100 Pa). So that I can compare the contour colour according to the limit set.

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

Star Strider
Star Strider 2022년 6월 2일

0 개 추천

As far as plotting them, in order to see the differences, it would likely be better either to subtract the two surfaces and plot the difference, or plot the squared difference between them (as ‘(pq1-pq2).^2’ ), providing that they have the same numbers of elements.
Without a second surface to plot, a description is the best I can do. Calculating the sum of the squared differences divided by the squared difference between one of the surfaces and the mean of the surface could produce something similar to a Coefficient of Determinatiion or other statistics that could be used to assess their overall similarities and the statistical probability that they are the same.
.

카테고리

도움말 센터File Exchange에서 Color and Styling에 대해 자세히 알아보기

질문:

2022년 6월 2일

댓글:

2022년 6월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by