- #1
debwaldy
- 38
- 0
1. Hi,
I am trying to model the magnetic force between two cylindrical identical sized permanent magnets. I am using the Charge/Coulombian model to do this. This assumes that all of the "magnetic charge" is on the pole ends of the magnet, i.e. the flat surfaces at the top and bottom of each cylinder.
I am doing these calculations in MATLAB. I have managed to write code which produces a graph of force on one magnet, say M1 due to a second magnet, say M2, but this code is cumbersome and very slow so I need to find a more efficient way of discretizing the magnet surfaces.
At the moment I am dividing these circular surfaces into equal sized uniform square facets. Then I iterate along the X and Y axis, which is what is slowing me down, to get the central positioni of each facet, but this gives me some facets which are not inside the circular surfaces, so I am using an if statement and pythagoras to determine whether my point lies in my circle or is merely on the square which surrounds my circle.
This is all very slow so what I was goin to try and do was somehow use the radius of the circle to plot a circular surface area, and then divide this circle into the eqqual sized square facets as before. However I don't know how to read in this circular surface area so that I will have a 2D array which contains every single facet point - I am new to MATLAB
Any help or ideas would be much appreciated
Thank you
I am trying to model the magnetic force between two cylindrical identical sized permanent magnets. I am using the Charge/Coulombian model to do this. This assumes that all of the "magnetic charge" is on the pole ends of the magnet, i.e. the flat surfaces at the top and bottom of each cylinder.
I am doing these calculations in MATLAB. I have managed to write code which produces a graph of force on one magnet, say M1 due to a second magnet, say M2, but this code is cumbersome and very slow so I need to find a more efficient way of discretizing the magnet surfaces.
At the moment I am dividing these circular surfaces into equal sized uniform square facets. Then I iterate along the X and Y axis, which is what is slowing me down, to get the central positioni of each facet, but this gives me some facets which are not inside the circular surfaces, so I am using an if statement and pythagoras to determine whether my point lies in my circle or is merely on the square which surrounds my circle.
This is all very slow so what I was goin to try and do was somehow use the radius of the circle to plot a circular surface area, and then divide this circle into the eqqual sized square facets as before. However I don't know how to read in this circular surface area so that I will have a 2D array which contains every single facet point - I am new to MATLAB
Any help or ideas would be much appreciated
Thank you