Drawing field lines with MATLAB

In summary, the conversation discusses solving for the electric field as a function of z for a uniformly charged half spherical shell with a total charge of Q and a radius of R. It also mentions drawing equipotential curves in the xz-plane with at least 8 equally spaced curves. The individual has already solved for the electric fields in the region z>R and z<R and is now trying to plot the field and equipotential lines in MATLAB using the function 'quiver3'. They are unsure if this function can accept coordinate systems other than cartesian.
  • #1
Minakami
4
0

Homework Statement


Consider a uniformly charged half spherical shell. The total charge is Q and the radius is R.

a) Calculate the electric field as a function of z for – 5R < z < 5R.
b) Draw equipotential curves in the xz-plane for – 5R < x, z < 5R with at least 8 equallyspaced
curves.



Homework Equations





The Attempt at a Solution


I solved for the electric fields in the region z>R and z<R so part a) is done.
I'm trying to plot this field and the equipotential lines in MATLAB but I couldn't figure out how. I haven't really used MATLAB before but I think MATLAB can definitely do this.
I understand that the equipotential lines are perpendicular to the electric field lines. So maybe I can use this fact to draw the equipotential lines...
 

Attachments

  • 12.jpg
    12.jpg
    9.1 KB · Views: 601
Physics news on Phys.org
  • #2
Investigate the function 'quiver3'. However, I am not sure if it accepts any other coordinate system other than cartesian.
 

1. How do I plot field lines using MATLAB?

To plot field lines using MATLAB, you will need to first define the vector field. This can be done using the "quiver" function, which takes in the x, y, and z components of the vector field. Once the vector field is defined, you can use the "streamline" function to plot the field lines.

2. How do I customize the appearance of the field lines in MATLAB?

To customize the appearance of field lines in MATLAB, you can use the various options available in the "streamline" function. This includes changing the line color, thickness, and spacing. You can also use the "hold on" function to add more graphical elements to the plot.

3. Can I plot multiple vector fields and field lines in the same MATLAB figure?

Yes, you can plot multiple vector fields and field lines in the same MATLAB figure by using the "hold on" function. This allows you to plot multiple sets of field lines on top of each other, making it easier to compare and analyze different vector fields.

4. How do I save the field lines plot as an image using MATLAB?

To save the field lines plot as an image in MATLAB, you can use the "saveas" function. This function allows you to save the plot in various image formats such as png, jpg, and bmp. You can also use the "print" function to save the plot as a PDF file.

5. Can I use MATLAB to plot 3D field lines?

Yes, MATLAB has the capability to plot 3D field lines using the "streamtube" function. This function takes in the x, y, and z components of the vector field and plots the field lines in a 3D space. You can also use the "view" function to change the perspective of the 3D plot.

Similar threads

  • Introductory Physics Homework Help
Replies
3
Views
1K
  • Electrical Engineering
Replies
6
Views
845
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Electrical Engineering
Replies
3
Views
2K
  • Electromagnetism
Replies
4
Views
941
Replies
1
Views
639
  • Introductory Physics Homework Help
Replies
5
Views
1K
Replies
22
Views
839
Replies
25
Views
1K
  • Introductory Physics Homework Help
Replies
16
Views
380
Back
Top