Basic 2D-contour plot
6 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone,
I am very new to Matlab and want to use it for a very basic data visualisation. I found some examples about 2D-contour plots, but no example worked for me and sometimes I had difficulties understanding certain functions.
I have a data file, which contains coordinates in x- and y-direction (first row and first column of an excel sheet). For every given position of these x- and y-coordinates there is a value.
There are plots that look very similar to what I aim for in the end:
My problem is, that getting the data out of my excel-file seems complicated and I don't know how to assign the coordinates to the values in Matlab.
I have currently a visualisation, but this one is based on Excel and does not fit certain optical requirements:
Also the interpolation of data between measured values is not very well done.
I am very glad about every answer that helps!
Best regards
Moritz
0 件のコメント
回答 (1 件)
Star Strider
2022 年 8 月 1 日
編集済み: Star Strider
2022 年 8 月 1 日
One optiono is to use the first column and first row as the appropriate coordinate vectors, and then the rest of the matrix as the array to use with contourf.
I am not certain what result you want.
One possibility —
Data = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1084750/data.xlsx')
xv = Data(1,2:end);
yv = Data(2:end,1).';
Cm = Data(2:end, 2:end);
figure
contourf(xv, yv, Cm)
colormap(jet)
colorbar
xlabel('X')
ylabel('Y')
EDIT — (1 Aug 2022 at 14:23)
.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!