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개)
% 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
Seelan Kumar
2022년 6월 2일
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.
Seelan Kumar
2022년 6월 2일
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에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
