How to create a vectorfield?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi everyone,
I would like to create a cube with vectors as elements, let's say a vector field of unit vectors e.i. length one. Is this possible and how is it done? Thanks for your input.
Best, Peter
댓글 수: 0
답변 (2개)
Sean de Wolski
2012년 12월 11일
편집: Sean de Wolski
2012년 12월 11일
doc meshgrid
doc quiver3
doc coneplot
Not sure of the details of what you want but it's likely some combination of the above.
More
Yes, you would use meshgrid for this:
The meshgrid would generate the coordinate matrices or rather the base of your vectors. Then you would need three more matrices of equal size that would be the components.
Here is an example that draws one unit vector at (0,0,0) pointing up and to the right with unit length:
s = fzero(@(s)1-sqrt((s^2)*3),1);
quiver3(0,0,0,s,s,s)
Now if you wanted it for the full thing, you could use s, repmat-ed to be the size of the output from meshgrid, etc.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!