フィルターのクリア

Adding Contour Lines to a 2D Surf Plot

12 ビュー (過去 30 日間)
Ayhan Hacioglu
Ayhan Hacioglu 2023 年 11 月 28 日
回答済み: Taylor 2023 年 11 月 30 日
Hello everyone,
I am working on plotting the stress distribution over a nonprismatic beam in MATLAB. The figure generated by my code is shared below (fig1). However, I am struggling to add contour lines to my plot, similar to what is shown in the second figure (fig2). I haven't been successful in achieving this, and I would appreciate any guidance on how to accomplish it.
Thank you in advance!
figure1
Figure2
My code is as below.
Here A is 1x3201 matrix while B and C are 40x3201 matrix
figure(13)
surf(A,B,C)
view(2)
shading interp
colormap(jet(1000))
xlabel('{\it x} (mm)'), ylabel('{\it y} (mm)')
hold on
grid off
c=colorbar('Location','southoutside')
axis([0 L -hmax/2 hmax/2])
axis off
c.Ticks = [linspace(min(C,[],'all'),max(C,[],'all'),7)];
Deci=arrayfun(@(x) sprintf('%.4f',x),c.Ticks,'un',0);
set(c,'xticklabel',Deci)

回答 (1 件)

Taylor
Taylor 2023 年 11 月 30 日
Replace
surf(A,B,C)
with
s = surf(A,B,C);
From there you can use dot notation to access the properties of the surface object. Specifically, you want to adjust the EdgeColor.

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by