Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

3D Magnetism Plot in Matlab

Status
Not open for further replies.

pollyRSA

Electrical
Joined
Jul 31, 2005
Messages
4
Location
ZA
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.
 
ok, i figured it all, so no need to worry.
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.
 
You're inputting strings; you need to convert to *real*

TTFN



 
shot bud,
i tried

inRad = inRad + 0.0;

etc, im guessing thats the best way to convert?
well it works, so thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top