How to add normal vectors/quivers to sphere in matlab?

In summary, to create a sphere in Matlab, you can use the built-in function <code>sphere</code> with the option to specify the number of points on the surface. To add normal vectors to the sphere, use the <code>quiver</code> function and adjust the appearance with additional input arguments. Different colors can be added to the vectors using the <code>C</code> input argument. The <code>surf</code> function can be used to change the appearance of the sphere, including adding a texture. To save the sphere with the added normal vectors as an image, use the <code>saveas</code> function.
  • #1
goonking
434
3
so I got my sphere, centered at (1,-2,0) with radius 3

upload_2015-12-20_21-49-21.png


how do I put normal vectors/arrows onto my sphere's surface?
I tried quiver3(x,y,z)
 
Physics news on Phys.org

FAQ: How to add normal vectors/quivers to sphere in matlab?

1. How do I create a sphere in Matlab?

To create a sphere in Matlab, you can use the built-in function sphere. This function will create a sphere with a radius of 1 centered at the origin. You can also specify the number of points on the surface of the sphere by providing an additional input argument.

2. How do I add normal vectors to a sphere in Matlab?

To add normal vectors to a sphere in Matlab, you can use the quiver function. First, you will need to calculate the normal vectors for each point on the surface of the sphere. Then, use the quiver function to plot these vectors onto the sphere. You can adjust the size and appearance of the vectors using the additional input arguments.

3. Can I add different colors to the normal vectors on my sphere?

Yes, you can add different colors to the normal vectors on your sphere by specifying the C input argument in the quiver function. This argument allows you to specify the color for each vector individually, such as using a gradient to represent the magnitude of the vector.

4. How can I change the appearance of my sphere in Matlab?

To change the appearance of your sphere in Matlab, you can use the surf function. This function allows you to specify the color, transparency, and lighting of the surface. You can also add a texture to the surface using the texturemap option.

5. Is there a way to save the sphere with the added normal vectors as an image in Matlab?

Yes, you can save your sphere with the added normal vectors as an image in Matlab by using the saveas function. This function allows you to save the figure in various formats, such as PNG, JPEG, or PDF.

Similar threads

Replies
2
Views
1K
Replies
2
Views
3K
Replies
8
Views
650
Replies
5
Views
2K
Replies
10
Views
3K
Replies
5
Views
762
Replies
16
Views
5K
Replies
3
Views
2K
Back
Top