Plotting surface charts when z is not a function of x or y
31 ビュー (過去 30 日間)
古いコメントを表示
I need to create a surface plot showing how SKL varies with both Pec and QBERI, but because this is a data set, it is not a function of either of them. Every resource I can find online about this requires the z variable to depend on the x and y, so I've been running into a lot of issues.
1 件のコメント
Adam Danz
2024 年 4 月 5 日 17:02
How many Pec values are there there? If there are only 4, then a surface plot doesn't seem like the right tool.
I don't see enough of the data to understand whether this suggestion makes sense but why not plot 4 line objects that each have their own Pec label?
hold on
plot(QBERI_1, SKL_1,'.','DisplayName','Pec=1.00E-06')
plot(QBERI_2, SKL_2,'.','DisplayName','Pec=7.00E-07')
plot(QBERI_3, SKL_3,'.','DisplayName','Pec=4.00E-07')
plot(QBERI_4, SKL_4,'.','DisplayName','Pec=1.00E-07')
legend()
採用された回答
Star Strider
2024 年 4 月 5 日 17:49
It would help to have the spreadsheet.
The data can be extracted from it using either table or matrix indexing, once it is immported.
That result needs to create an array like this —
A = [NaN 1E-06 7E-7 4E-7 1E-7
1E-3 2.17E-8 2.18E-8 2.20E-8 2.21E-8
7E-4 2.21E-8 2.23E-8 2.24E-8 2.26E-8
4E-4 2.26E-8 2.27E-8 2.26E-8 2.31E-8
1E-4 2.31E-8 2.32E-8 2.34E-8 2.36E-8];
figure
surfc(A(2:end,1), A(1,2:end), A(2:end, 2:end))
colormap(turbo)
colorbar
xlabel('QBERI')
ylabel('Pec')
zlabel('SKL')
view(60,30)
Then creating the surface or contour plot (or both) is straightforward.
.
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!