3D Magnetism Plot in Matlab
3D Magnetism Plot in Matlab
(OP)
sorry, another newbie question.
i fully understand how a curve should look, and how to use meshgrid, mesh etc. problem is, i cant get my problem translated into matlab.
in 2D - the curve is a straight line
(1) y = mx for 0 < x < r (r being some constant)
then once x = r, the curve is an exponetial, along the lines of
(2) y = 1/x
the problem is, i need this in 3D. from the top view, the plot must be a circle. as the circle expands, the z-axis follows the 2D curve. u could imagine its like a donut, the middle is not quite empty, but its height is low. as u expand from the centre of the donut, the hight increases. once u get to the edge of the donut tho, the height falls away rapidly.
i hope people can understand this. if anyone has done a bit of magnetism, it's the plot of magnetic flux density B, of a circular current carrying conductor with radius r.
i fully understand how a curve should look, and how to use meshgrid, mesh etc. problem is, i cant get my problem translated into matlab.
in 2D - the curve is a straight line
(1) y = mx for 0 < x < r (r being some constant)
then once x = r, the curve is an exponetial, along the lines of
(2) y = 1/x
the problem is, i need this in 3D. from the top view, the plot must be a circle. as the circle expands, the z-axis follows the 2D curve. u could imagine its like a donut, the middle is not quite empty, but its height is low. as u expand from the centre of the donut, the hight increases. once u get to the edge of the donut tho, the height falls away rapidly.
i hope people can understand this. if anyone has done a bit of magnetism, it's the plot of magnetic flux density B, of a circular current carrying conductor with radius r.





RE: 3D Magnetism Plot in Matlab
cept theres a new problem thats bugging me:
iv created a GUI so users can input parameters like current, radius etc... i then need these values to plot the curve. so for example iv sed:
current = get(handles.editCurrent,'String');
inRad = get(handles.editInRad, 'String');
muR = get(handles.editInMuR, 'String');
% display values in command window
muR
inRad
current
- if i simply display them, the values i enter r exactly the same. the problem occurs wen i use the values. if i multiply muR by inRad for example, it turns out to be a 1x4 vector!!! somewhere three extra values got put in.
i hav noticed it only happens if i make the values more than one digit.
eg if i use '1' or '5', there is no problem but '0.05' or '2000' tend to get all messed up. any ideas
thanks.
RE: 3D Magnetism Plot in Matlab
TTFN
RE: 3D Magnetism Plot in Matlab
i tried
inRad = inRad + 0.0;
etc, im guessing thats the best way to convert?
well it works, so thanks!