How to include quiver plot in this 3d surface plot?

조회 수: 17 (최근 30일)
priya anjali
priya anjali 2020년 6월 23일
댓글: Star Strider 2020년 6월 27일
I'm having problem in plotting surface with its quiver3 plot.
Kindly help anyone. I'm attaching my file.
  댓글 수: 1
Michael Soskind
Michael Soskind 2020년 6월 23일
Hi Priya. It might be helpful to understand how you would like to define the direction, and does the magnitude matter? What are the values you are looking to use for the quiver plot?
If you answer those questions, I am sure someone would be able to help you answer the question more effectively.
As a quick solution, I would advise doing something as follows:
hold on;
quiver3(x,y,z1,u,v,w);
Hold will allow you to add the quivers to the plot, and the u,v, and w are the directional cosine values that I am referring to would be useful to know what they are in your above file.
Hope that makes sense, and helps you,
Michael

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2020년 6월 23일
Try this:
(EARLIER CODE OMITTED)
figure
surf(x,y,z1);
xlabel('\bf{x}','fontsize',10);
ylabel('\bf{y}','fontsize',10);
zlabel('\bf{u(x,y,t)}','fontsize',10);
title('\bf{t=0.5056 }','fontsize',10);
hold on
hold on
[dx,dy] = gradient(z1); % Calculate Gradient
wm = -hypot(dx,dy); % Z-Slope
quiver3(x,y,z1, -dx, -dy, wm) % ‘quiver3’ Call
hold off
That appears to me to produce the correct result.
I cannot promise that it is robust to other problems, since I have not used it with them.
.
  댓글 수: 2
priya anjali
priya anjali 2020년 6월 27일
Thank you its works.
Star Strider
Star Strider 2020년 6월 27일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by