Contour comparison with same colorbar limits.
4 views (last 30 days)
Show older comments
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;
0 Comments
Answers (2)
Voss
on 2 Jun 2022
% 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 Comments
Voss
on 2 Jun 2022
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.
Star Strider
on 2 Jun 2022
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.
.
0 Comments
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!