How to create a vectorfield?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Sean de Wolski
el 11 de Dic. de 2012
Editada: Sean de Wolski
el 11 de Dic. de 2012
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 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!