Matlab, Three Dimensional plot of three charges

In summary, the program needs to be able to accept the locations of three points on a three dimensional plot XYZ, as well as having certain 'intensities' or 'magnitudes' that signify their charge. It must also plot these three points, the intensities are suppose to affect the following that must be plotted as well. Conceptually Matlab isn't much different from C++, just without the objects (I think?), and some conveniences for math, especially its matrices, which are really arrays but with lots of handy ways to operate on them.
  • #1
studentengie
3
0
What the program needs to do is quite simple, the problem is that I lack the knowledge needed to program in matlab.

I know how to program in assembly and C++ and that's about it, this would not be a problem for me if my University gave formal courses in how to use Matlab.

Here is what the program needs to be able to do.

It must accept the locations of three points on a three dimensional plot XYZ, as welll as having certain 'intensities' or 'magnitudes' that signify their charge

Point 1 (X,Y,Z) and Q
Point 2 (X,Y,Z) and Q
Point 3 (X,Y,Z) and Q

as well as plotting these three points, the intensities are suppose to affect the following that must be plotted as well.

Equipotential lines between the point charges
Electric field lines between the point charges
 
Physics news on Phys.org
  • #2
What approach would you take in C++?

This looks like something that could be done with the finite element or finite difference (?) method. But I guess there's an easier or analytic way you have in mind.

Conceptually Matlab isn't much different from C++, just without the objects (I think?), and some conveniences for math, especially its matrices, which are really arrays but with lots of handy ways to operate on them.

I think you should write a simpler program first, like just plot a function to get familiar with the syntax.

Wouldn't you have equipotential planes in 3D, not lines?
 
  • #3
What type of plots do you have in mind? If you input your three positions + charge as a 3x4 matrix (each row = a charge), call it A, you can make a 3d scatter graph using something like

Code:
A = [2,1,3,7;1,2,3,3;0,2,1,20];
scatter3(A(1,1:3), A(2,1:3), A(3,1:3), 100*A(:,4),'x')

The first three arguments are the x, y, z coordinates (vectors with numel = number of points you want to scatter), the 4th argument is the markersize - bigger charges could be represented by bigger crosses.

Regarding surface equipotentials and electric field lines, it may be possible to plot on one graph but the image will probably be very confusing.
 
  • #4
MikeyW said:
What type of plots do you have in mind? If you input your three positions + charge as a 3x4 matrix (each row = a charge), call it A, you can make a 3d scatter graph using something like

Code:
A = [2,1,3,7;1,2,3,3;0,2,1,20];
scatter3(A(1,1:3), A(2,1:3), A(3,1:3), 100*A(:,4),'x')

The first three arguments are the x, y, z coordinates (vectors with numel = number of points you want to scatter), the 4th argument is the markersize - bigger charges could be represented by bigger crosses.

Regarding surface equipotentials and electric field lines, it may be possible to plot on one graph but the image will probably be very confusing.


Basically I am looking to make a three dimensional plot, X Y Z axis...I know this is extraordinarily confusing but my professor didn't give me a lot to work with here, he just laid out in so few words what needed to be accomplished.
 
  • #5
At this point I am a week before finals, I am most likely going to have to write a design document for the program and explain what it would do and how it would do it, and hope for the best.
 

1. What is Matlab?

Matlab is a high-level programming language and interactive environment used for numerical computation, visualization, and application development.

2. How do I create a three dimensional plot in Matlab?

To create a three dimensional plot in Matlab, you can use the "plot3" function. This function takes in three arrays as input, representing the x, y, and z coordinates of the points to be plotted.

3. What are the three charges in a three dimensional plot?

In a three dimensional plot of three charges, the three charges refer to the magnitude and position of the three electric charges in the plot. These charges can be represented by the values of their x, y, and z coordinates.

4. How do I calculate the electric field at a specific point in the three dimensional plot?

To calculate the electric field at a specific point in the three dimensional plot, you can use the "Efield" function in Matlab. This function takes in the coordinates of the point and the positions and magnitudes of the three charges, and returns the electric field at that point.

5. Can I customize the appearance of the three dimensional plot in Matlab?

Yes, you can customize the appearance of the three dimensional plot in Matlab by using different plotting functions and adjusting the properties of the plot such as color, transparency, and size. You can also add labels, titles, and legends to enhance the visualization of the plot.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
939
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top