Contour plot for a non rectangular object
조회 수: 32(최근 30일)
표시 이전 댓글
Ghazwan 2022년 10월 5일
댓글: William Rose 2022년 10월 6일
I have this case that I worked out in another software.
In the attached file, you can see the X,Y coordinates. The third column represents the results that I need to plot in a contour silimar to the one in the image above.
I tried several codes, but all of them plot on a rectagular area and/or not showing the same shape for the contour area. For example, the following code:
xyz = xlsread('data.xlsx');
댓글 수: 0
William Rose 2022년 10월 5일
[X,Y]=meshgrid(x,y) makes a grid where all the x values are the same across the grid, and likewise for yhe y values.
You can fix it by making your own X and Y instead of using meshgrid.
dx=1; dy=1; %adjust as desired
[X,Y]=meshgrid(x,y); %initial approximation
xlabel('X'); ylabel('Y'); axis equal; view(0,90)
%next: adjust the grid Y-values
xlabel('X'); ylabel('Yadj'); axis equal; view(0,90)
It works. The code to adjust the y-values is not very elegant, but it demonstrates the possibilities for creating a non-retangular grid.
댓글 수: 4
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!