Adding a circle in a 3D surface plot, viewed in 2D
이전 댓글 표시
In the given code section, I am plotting some values as Z-coordinates in a surface plot, and then viewing it in 2D. I want to mark a circle on the same plot, given by the equation (x-13.125e-3)*(x-13.125e-3)+(y-5e-3)*(y-5e-3)=1.25e-3*1.25e-3. 'fplot' did not work, as I had assumed. How do I do it then?
figure(1)
[X,Y]=meshgrid(unique(CORD(:,1)),unique(CORD(:,2)));
surf(X,Y,damageFactorForAllNodesAtEndTimeStepReversed)
shading flat
colorbar("eastoutside")
xlabel("Length of sample")
ylabel("Width of sample")
title("Crack path at end time-step for homogeneous plate with soft inclusion")
view(2)
hold on
fplot(@(t) 1.25e-3*sin(t)+13.125e-3, @(t) 1.25e-3*cos(t)+5e-3)
If any other information is needed, do ask.
댓글 수: 1
hello
seems the code itself should work as in this example below
we cannot run exactly your code as you don't provide the data along , but the idea in itself is fine : just be aware that your circle may be hidden partially of completely depending of it's z values vs the surf z values : demo below
surf(peaks)
shading flat
colorbar("eastoutside")
xlabel("Length of sample")
ylabel("Width of sample")
title("Crack path at end time-step for homogeneous plate with soft inclusion")
view(2)
hold on
% fplot(@(t) 5*sin(t)+13, @(t) 5*cos(t)+25,'r'); % works , full circle is visible
fplot(@(t) 5*sin(t)+18, @(t) 5*cos(t)+25,'r'); % works , but only a fraction of the circle is visible
% fplot(@(t) 5*sin(t)+25, @(t) 5*cos(t)+25,'r'); % doesn't work !! the
% circle is "below" in Z dir vs the surf object
hold off
%axis equal
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 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!

