plotting a vector field in polar coordinates
조회 수: 33 (최근 30일)
이전 댓글 표시
I have a Field given by 3 components. < rho theta z> in cylindrical
E = p*cos(theta),P*sin(theta),z^2 I wish to plot this vector field.
How do i do this. Quiver seems to only work for rectangular. I have also seen people try to convert the field to rectangular which has not worked either. I am at a complete and total loss
댓글 수: 0
답변 (2개)
Star Strider
2015년 2월 14일
The quiver3 function can do 3D quiver plots. You have to have derivatives of your components as well, but you can calculate them easily enough once you know how you want to take the derivatives. Are ‘p’ and ‘P’ different or a typo? Are they constants or variables as well, and if so, what are they functions of?
An example of your code or an illustration of what plot result you want would help.
댓글 수: 5
Star Strider
2015년 2월 14일
편집: Star Strider
2015년 2월 14일
————————————————————————————————————————————
Previous Comment: Your 2D example worked because ‘a’ and ‘b’ were the origin points and the sin functions acted as the directional derivatives at those points (at least as far as quiver was concerned).
I didn’t say that quiver or its friends required an independent variable ‘t’ or anything else. I was implying that if your variables were functions of ‘t’ (parametric functions), the directional derivatives would have to be with respect to ‘t’, or whatever the variable was.
Regardless, the first three arguments to quiver3 are the origins of the arrows and the last three arguments are the directions the arrows go. How you choose to define them is entirely up to you. I still have absolutely no idea how you want to define the directional derivatives with respect to your ‘E’ variable, so I can’t help you with that. I also don’t know if ‘E’ are your directional derivatives, the origins of the arrows, or something else. (An easy way to get the last three arguments for quiver3 if you have vectors for the first three, is to use the gradient function.)
I’m just guessing at what you’re doing. You have to provide the details. If you code your cylindrical coordinate system and plot it with quiver3, I will have some idea. If it doesn’t work, I can probably help you get it to work. No promises.
Code would quite definitely help me understand what you’re doing.
Hassam Alhajaji
2021년 5월 6일
@Robert None of your variables are a function of time if your field is static
Aneesh Vasudev
2018년 4월 10일
Robert, you could try to use the following code (hope it works, havn't checked it).
function [x,y,u_x,u_y]=Fieldpol2cart(r,O,u_r,u_O)
[x,y] = cart2pol(O,r);
u_x = u_r.*cos(O) - u_O.*sin(O);
u_y = u_r.*sin(O) + u_O.*cos(O);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Vector Fields에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!