COMPGROUPS.NET | Post | Groups | Users | Stream | Browse | About | |

### Plot field lines of vector fields using streamslice

• Email
• Follow

I am currently working on a little script to visualize TE and TM modes in rectangular and circular waveguides and cavity resonators. I have 3 vector fields (Hx,Hy,Hz) for the magnetic field and 3 vector fields for the electric field (Ex,Ey,Ez) which makes my problem a 4 dimensional one.
I am getting satisfactory results with a combination of slice to plot slices showing the intensity of the electric and magnetic fields and streamslice to show the corresponding field lines within the planes.

My only problem is that streamslice plots field lines equidistant to each other. But since the intensity of electric and magnetic fields in one area is directly proportional to the density of its field lines, I would like to have more field lines in areas with higher intensity and less or no field lines in areas with little intensity.

Since you can access the vector coordinates of the lines produced by streamslice, my idea was just to remove a few to make the line density approximately corresponding to the field intensity. Though I had no luck with this yet.

Any help and suggestions are appreciated

 0

See related articles to this posting

"PaulS Sochor" <magical_jp@hotmail.com> wrote in message <hrkng4$m75$1@fred.mathworks.com>...
> I am currently working on a little script to visualize TE and TM modes in rectangular and circular waveguides and cavity resonators. I have 3 vector fields (Hx,Hy,Hz) for the magnetic field and 3 vector fields for the electric field (Ex,Ey,Ez) which makes my problem a 4 dimensional one.
> I am getting satisfactory results with a combination of slice to plot slices showing the intensity of the electric and magnetic fields and streamslice to show the corresponding field lines within the planes.
>
> My only problem is that streamslice plots field lines equidistant to each other. But since the intensity of electric and magnetic fields in one area is directly proportional to the density of its field lines, I would like to have more field lines in areas with higher intensity and less or no field lines in areas with little intensity.
>
> Since you can access the vector coordinates of the lines produced by streamslice, my idea was just to remove a few to make the line density approximately corresponding to the field intensity. Though I had no luck with this yet.
>
> Any help and suggestions are appreciated

a few slices of ML code would help...

us

 0

Sorry, here is some code which should explain my problem. The density of field lines is almost uniform. Going from the edge to the center the density of field lines should actually be decreasing.

a=100;
b=10;
c=100;
d=sqrt(a^2 + c^2);

T=0.3;

[X,Y,Z]=meshgrid(0:1:a, 0:1:b, 0:1:c);

Hx= (a/d)*sin((pi*X)/a).*cos((pi*Z)/c).*sin(pi*T);
Hy= zeros(size(X));
Hz= -(c/d)*cos((pi*X)/a).*sin((pi*Z)/c).*sin(pi*T);

W= sqrt(Hx.^2 + Hz.^2);

slice(X,Y,Z,W,[],[b],[]);

[hverts haverts]= streamslice(X,Y,Z,Hx,Hy,Hz,[],[b],[],1,'linear');
hlines= streamline([hverts haverts]);
set(hlines,'LineWidth',3,...
'Marker','.',...
'MarkerSize',3,...
'MarkerFaceColor','k',...
'Color','k')

view(0,0),axis([0 a 0 b 0 c])

 0
 comp.soft-sys.matlab 201604 articles. 514 followers.

2 Replies
1746 Views

Similar Articles

[PageSpeed] 32

• Email
• Follow

Similar Artilces:

How to plot a line onto a vector field? Using Maple 9...sorry
See previous message. ...

How to plot a line onto a vector field?
Hello. I'm doing line integrals and I wanted to plot my paths onto the vector field from (0.0) to (4.2). This is what I did to create the vector field. with(plots): fieldplot( [-1*y, 2*x], x=-0..5, y=0..3, arrows = slim); Now I want to plot these paths below ONTO my vector field. plot( x^(1/2), x=0..4 ); plot( 1/2*x, x=0..4 ); plot( 1/8*x^2, x=0..4); How to I merge these lines onto the vector field instead of having separate plots? Thanks in advance. In article <mwyzb.413263$Tr4.1190058@attbi_s03>, <JustMe@Home.com> wrote: >Hello. I'm do... Re: How to plot a line onto a vector field? Thanks Steve!! I wanted to show a nice picture using maple along with my "Work" calculations. Thanks again! ... vector-field plot Hi, I have a unit vector of three components, Rx=Sin[p]*Cos[q]; Ry=Sin[p]*Sin[q]; Rz=Cos[p]; where, p=(Pi/2)*(1-z); and q=p*Cot[p]; I want to plot the vector-field of this unit vector in the region, {z, 0,1} and {q,0,0.5} Nilaakash, Your question is not very clear. Actually you aren't asking anything but are only making a statement ;-) You seem to want to plot a 3D vector field and you have given equation for their direction. However, you should also provide information about their *position* and you haven't done that. You're talking about a region given by... plot a vector field Hi, are there anybody who tried to write a function to plot 3d vector field? I know quiver3 command can do this. But I want to know if there is any function that can take symbolic expression as input. For example, given a vector field F= [2*x, sin(y), x+z], where x y and z are symbols, a function like this plotvectorfield(F,[xmin,xmax,ymin,ymax,zmin,zmax]) will plot the field lines. Did anybody try this? Thanks. A 3-d automatic field line plotting routine is sorely needed, but I have only found a 2-D version, fieldlines.m at the file exchange. If you find a 3-d version, let me know.... How to plot field lines ? Hello, I'm new here. I have some complicated deformed dipolar magnetic field in cartesian components, and I need to show some field lines. I'll also have to extract coordinates of lines to a list. How should I do that ? I can use the code below (with properly defined functions fx, fy and fz), but it's unreliable (it frequently hit the singularity at the center) and it frequently gives many unpredictable curves. Any idea ? Please, I need help ! :-( FieldCurve = NDSolve[{ x'[t] == fx[ x[t], y[t], z[t] ], y'[t] == fy[ x[t], y[t], z[t] ], z'[t] == fz[ x[... plot field lines I want to plot TE and TM modes in rectangular waveguides. Actually lines of electric and magnetic field. I want that the density of lines to be proportional to the intensity of the fields. I tried the command contour but it plots the intensity as a function of color. On Aug 2, 10:16=A0am, "Nada Sekeljic" <inada...@engr.colostate.edu> wrote: > I want to plot TE and TM modes in rectangular waveguides. Actually lines = of electric and magnetic field. I want that the density of lines to be prop= ortional to the intensity of the fields. I tried the command contour but it= plots... plot vector field Hi, I have an easy question for a gnuplot expert. I have in output from a fortran program a vector field (magnetic field) defined in every point of space. The code is not a grid, but my output is a file with 6 columns at every line: the coordinate XYZ and the values of Bx, By, Bz. How can I plot in gnuplot the field lines? Thanks a lot!!! On 21.11.2010 03:30, Fred wrote: > Hi, I have an easy question for a gnuplot expert. Actually, it should be trivial vor everybody. How hard could it have been to find "help vectors", while looking for this? On Nov 21, 4:51 am, H... Plotting constant field lines Hello, I have 2 questions related to an equation for a magnetic field vector, B, from a dipole in cylindrical coordinates: B = (u0*m/4*Pi*r^3)* {2 Cos[theta] , Sin[theta]} where the first index is the r component and the second is the theta component. First, how do I use VectorPlot to plot this in cylindrical coordinates? Second, without using any higher end built in Mathematica functions, How do I get Mathematica to plot field lines of constant Magnetic field strength? I'm using PolarPlot, but coming up short. I am attempting to recreate the field lines as shown on... plotting vector fields on a map Hi there, I just wonder it is possible to plot a vector field on a map using mapping toolbox functions. Is there something like quiverm function? Regards, Ico ... quiver plot a vector field I am trying to plot a 2d vectorfield; and though it is not yet working, it seems close: fieldcoef=[-13 -13; -13 12] ; x = [-1:.2:1]; y = [-1:.2:1] ; [xgrid ygrid]=meshgrid(x,y) ; % values=fieldcoef*[x;y] ; % Not proper syntax xy=[x;y] values=fieldcoef*(xy) ; quiver(xy(: 1),xy(: 2),xgrid,ygrid) ; --------------------------------------------- ??? quiver(xy(: 1),xy(: 2),xgrid,ygrid) ; | Error: Unexpected MATLAB expression. Any suggestions? RogerM Roger M wrote: > > > I am trying to plot a 2d vectorfield; and though it is not yet > wo... plotting a vector field in 3d Hi, I am trying to plot a vector field in 3d and i have great difficulty in doing so. I have 3 variable, bx,by,bz that have (nx,ny,nz) dimentions which represent the vector field. My questions are: 1) How can i plot this vector field. I have tryied a variety of things (flow3 etc) i found online but all advices seems to lack some part of information and i fail to reproduce the results. I also whould like a hint on how i could overplot those lines above an xy image on the bottom of the plot. 2) Is there a way to trace the field lines and have, lets say 3 variables of dimentions (nlin... vector field plot in polars hi all, how do i plot a vector field given (spatial dependence) of vector components in polar coordinates? i.e. I have E_r(\theta,r) and E_{\theta}(\theta,r) and would like to have a vector field plot from this. cheers. Zhen.Guoliang@gmail.com wrote: > hi all, how do i plot a vector field given (spatial dependence) of > vector components in polar coordinates? i.e. I have E_r(\theta,r) and > E_{\theta}(\theta,r) and would like to have a vector field plot from > this. cheers. Convert the inputs from polar to cartesian coordinates as part of the 'using' specific... plotting a 3D vector field ? Hi, Is it possible to use gnuplot to plot a 3D vector field. say I have a Nx6 matrix of co-ordinates and components as in x,y,z,vx,vy,vz in each row. sincerely b thomas In article <CQoGd.7542$re1.6353@fe2.columbus.rr.com>, B Thomas <thomasb> wrote: >Hi, > >Is it possible to use gnuplot >to plot a 3D vector field. >say I have a Nx6 matrix of >co-ordinates and components as in >x,y,z,vx,vy,vz in each row. > Yes. 3D vector fields were added to the development source tree in Sep 2004. Download the current version from SourceForge. ...

3D Vector Field Plot?
I tried to plot 3D vector field using Gnuplot command: 'splot "data.dat" with vectors', (data.dat have 6 column: x y z Ex Ey Ez) but it doesn't work. What shall I do? Please help me! 2D vector field was succeeded. In 3D case, points was plotted. Not vectors. Gnuplot version 4.0, ChangeLog file Feb. 6. 2006 The with vectors plotting style applies only to 2D plots in gnuplot 4.0. In the development version, it works with 3D plots as well. You can download and compile the source yourself, (easy on any *nix-like system) or use the precompiled binaries f...

Plotting Vector Fields in Mathematica 7
Hello, In Mathematica 6, there seems to be no way to specify the size of the arrow heads used by FlotVectorField. Therefore I resorted to the following workaround: Graphics[{ Arrowheads[0.02], VectorFieldPlot[..][[1,3]] }] but this depends on the internal structure of the graphics object returned by VectorFieldPlot and is therefore likely to cause trouble. Is this still required in Mathematica 7? Best, -Nikolaus -- =C2=BBIt is not worth an intelligent man's time to be in the majority. By definition, there are already enough people to do that.=C2=AB...

How to plot the magnetic field vector along the trajectory
Dear all, I have the magnetic field data and spacecraft position data. I want to plot the magnetic field vector along the trajectory. I think I should first plot the spacecraft trajectory, and then plot the magnetic field vector along the trajectory. But I do not know which procedure in IDL can perform the second step. Is there anyone who can can help me? Best wishes, Du duxiyu@gmail.com writes: > I have the magnetic field data and spacecraft position data. > I want to plot the magnetic field vector along the trajectory. > I think I should first plot the spacecraft trajectory, and...

how can I plot field lines similar to contour?
I haven't been able to find a nice solution, so... How can I plot field lines from 3-D vector data in a way similar to what contour does for 2-D data? With contour, you can pick the number of contour lines you want and even the levels at which to plot them. However, there seems to be no similar way to plot field lines. I found a simple but effective 2-D solution at the file exchange: http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=5710&objectType=file Is there something similar in 3-D? I know quiver3 draws arrows, but it does not connect them and form a ...

plotting streamlines / vector fields for systems of ODE
Hi there, I would like to plot streamlines and/or vector fields for systems of several odes, by which I mean systems of 3D or more and plots of 2D or 3D. I have been able to use routines like quiver, quiver3, streamslice, streamline, and coneplot, with varying degrees of success, for 2D and 3D systems... the matlab examples always look a lot work better than my systems! Now I have some 4D and 5D systems for which I would like to simulate some trajectories and plot a series of 2D plots for selected pairs of the variables. I know how to plot several trajectories by selecting initial condition...

How do I set vector fields using user-input?
Hi guys, I'm new to scheme programming and encountered problems assigning user- input values to vectors. My program flow is as follows: 1. Prompt user to specify how many fields in a vector eg: if user key 3, the vector shall have 3 fields. 2. Prompt user to input values into the 3 fields I tried using : (vector-set! 4AUVector 0 '(read)) 4AUVector is my vector name, 0 is the 1st field, and (read) is the user-input, but I got.. vector-set!: expects type <mutable vector> as 1st argument, given: #(0 ,1 ,2); other arguments were: 0 (read) I believe my syntax is wrong, but I jus...

read from a file and plot a 3d vector field.....
Hello: I would like to read a vector field form a file and plot it in three dimensions. The file format is : n x y z v_x v_y v_z where n is the data number, x, y, and z are the Cartesian coordinates and v_x, v_y, and v_z the components of the vector field. I was wondering if something like this can be plotted with maple 9. I couldn't find any hint in the manual apart from the fieldplot3d which seems to work with procedures or analytical expressions. Thanking you in advance for any help Andres In article <432751ad$0$165\$a3f2974a@nnrp1.numericable.fr&g...

List plotting a vector field containing invalid data
I'm solving a 2D CFD problem, which is generating a lot of co-located 2D velocity field data, using a regular rectangular grid. Some of the grid is masked out, representing ocean bottom topography. Is there a relatively simple way to modify ListPlotVectorField to ignore the masked out values (which are stored as as unphysically large values, but this is easily modified) Thanks. Gareth, Why don't you use the second form of ListPlotVectorField? "ListPlotVectorField[{{pt,vec},{pt,vec},...}] displays a list of vectors, each based at the corresponding point."...

experimental animated von Koch field line plot...
The following is one of the experiments I am working on wrt exposing von Koch curves to gravitational field lines. AFAICT, the UI should remain response throughout the extensive computations involved. Its probably not a good idea to view this on a phone? Well, here is the link: http://webpages.charter.net/appcore/fractal/field/experimental Does it work for you? :^o On Thursday, January 16, 2014 2:45:48 PM UTC-6, Chris M. Thomasson wrote: > The following is one of the experiments I am working on wrt exposing von > Koch > curves to gravitational field lines. AFA...

Nicer vector field plot, arrows should all start on the grid
Hi, I'm using Maple 10 on Linux and I am not satisfied with the behaviour of fieldplot. One little example: with(plots): feld := vector([sin(y),0,0]); fieldplot3d(feld,x=-1..1,y=0..2*Pi,z=-1..1,grid=[5,15,5],arrows=THICK); If you rotate the plot, so you look on the top you should see what I mean. The arrows don't start on the grid. It's more like that the middle of each arrow is on the grid. Is there an easy way to fieldplot a vector field so that the endings of the arrows are all on the grid? Thanks in advance, Sebastian. ...