Plot field lines of vector fields using streamslice

  • Permalink
  • submit to reddit
  • 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
Reply PaulS 5/2/2010 8:32:04 PM

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
Reply us 5/2/2010 8:38:04 PM

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
Reply PaulS 5/2/2010 10:39:03 PM
comp.soft-sys.matlab 203940 articles. 540 followers. Post

2 Replies
2239 Views

Similar Articles

[PageSpeed] 4


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

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...

using lookup and display only field as control field
I am not sure If I can do this with a lookup, but what I would like to do is perhaps use lookup to retrieve a control date from an unassociated table to control what date is entered in another table. For example : the main table , table 1 has many entries with a field called date_ enter which is the date the record was entered. table 2 has a control_date If the date entered in table 1 is less than or = to the control date we want to give the user a error message. I am thinking of using display only field and lookup to set it Would need to have the date value from the control table availabl...

Using part of a field to fill in another field?
I am making an inventory database. I have a field InventoryNumber where I put a specific code. The code always starts with a particular letter. I would like to fill in another field with specific information based on what that letter is. Can somebody show me how to do this? Thanks in advance. Hmmm...there are a lot of ways that you can do this. It depends on how many possibilities you have for that first letter. If there are lots of possibilities OR if you expect the list to grow, you could create a table that holds the list of your 'specific information' and a letter ID that ...

How to use data in a field as a label to another field??
Is it possible to use the data in a field of one file as a label to a field in another file. Here is my problem. My company uses a third part that they receive orders from. This company passes me a file for each order in what the call a tag file. Each record in the file contains the following three field in a comma delimited format "fieldname","scope","actual data" "Name","Ord","John Smith" "address1","Ord","123 Wacker Dr" .... "ShipToName","Ord","John Doe" .... "Qty...

update field using substrings of another field
Have a table with fnumber and number, both text fnumber is a phone number, format "8005551212" number needs to be the same number but in the format "(800) 555-1212" we currently run the following each time the list is updated; update pnums set number='(' || substring(fnumber from 1 for 3) || ') ' || substring(fnumber from 4 for 3) || '-' || substring(fnumber from 7 for 4); is there a way to statically set that number field so that it always equals the fnumber in that format, or automatically updates itself when the fnumber field is cha...

Filling in separate fields using checkboxes in one field
I am using checkboxes to select the names of various exercises from a value list. From these selections I would like to copy the names of exercises into separate fields(within the same record): excercise1, exercise2, exercise3, ....exercise10. Checkbox Field "Name of Exercise" pronation(not checked) flexion(checked) extension(not checked) abduction(checked) internal rotation(checked) Fields result in: exercise1= flexion exercise2= abduction exercise3= internal rotation exercise4= (waiting for next checked box) I was wondering if anyone could help me figure out this calculation. ...

Merge a field into a field
I have an email distribution list. I need to add the person's name in the body of the text. What do I do to merge one field into another. I know that <<>> doesn't work. thx Create a textfield Create a calculated field into the textfield type your text, where you want the name to go type QWERTY (or any other code you like) In the calcfield (result text) Substitute ( textfield ; "QWERTY"; NameField) More options ofcourse are possible, this is just clean and dirty. Ursus <fromero@csudh.edu> schreef in bericht news:1138227655.180034.311000@o13g2...

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...

Form fields to same field
I have a form to be completed by a teacher. They are to input 30 grades on the form (along with teacher name, period number, etc). This will store all 30 grades in one field in my sql table. The multiple forms into one field has me baffled. I am a newbie but appreciate all the help! Thanks in advance. >I have a form to be completed by a teacher. They are to input 30 >grades on the form (along with teacher name, period number, etc). This >will store all 30 grades in one field in my sql table. Is that 1 grade each for 30 students? Better be sure you keep the order straight if so, a...

using awk with fields that have field seperator in od places
sample data "fd1","fd2","f3","fd4","fd5","field6 , data,abc","field7"..."field13" , is field separator " is text separator the field i consider field 6 may have one or more commas in it what i want to accomplish is to read field 13 which is unique and may have only 4 different values here is what i have been doing WARNING i take no responsibility for any injuries caused by falling out of chair laughing when reading my script.. #!/bin/bash #script name get_fru.scr #usage ./get_fru.scr (filename) # g...

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...

Using a subroutine to populate a field in Access
I have a subroutine I want to run whenever an Access record is updated. Sub Form_BeforeUpdate(Cancel As Integer) Me!LastUpdated = Now End Sub It updates this date field with the current date whenever a record is changed. How do I tie this sub to the field in Access, so that it fires on change? Thanks. bp Access does not have triggers, so you cannot achieve this at the table-level. The code you have is the right approach, provided all changes are made through the form. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips...

using a Yes/No field to condition another fields property
i want to use a Yes/No field to set another objects back colour to change to indicate an item is on loan. e.g. when the Yes/No field is set to YES the object 'text box' back colour is set to Red. also i would like to have a condition that when the Yes/No field is set to NO then the text box - 'borrower details' and text box - 'date on loan' is cleared of any details that were entered. can anyone help with this? Put the following code in the AfterUpdate event of the Yes/No field: If Me!NameOfYesNoField = True Then Me!TextBox.Backcolor = "255" Else M...

Split a field into multiple fields using space as delim
Hi - and thanks for reading this. I'm setting up a scheduled routine which links to an existing file. It's bringing in one field which has at least 2 and maybe 10 'words', separated by spaces, which I'd like to split into separate fields. So: ALTAI RPS 21 CX HPH would become ALTAI in a new field, RPS in the next new field etc. At the moment, I'm wrestling with a query with instr functions all over the place. If anyone has seen/used a routine to simplify this, I'd be very grateful! Cheers. Andy. See the ParseWord() function here: http://allenbrowne.com/func-10....

Compliant way to use offsetof for a field within a field?
Is there a compliant way of getting the offset of a field within a field? I'm mainly using this to do compile-time checks that fields are at the offset I expect them. I'm using offsetof( NameOfStruct, field1.field2 ) now and this works, but with some compilers, I'm getting a warning about "Using extended field designator is an extension". Here's an example: typedef struct { uint8_t x; uint8_t y; struct { uint8_t z; } fields; } Test; compile_time_assert( offsetof( Test, x ) == 0 ); // Works compile_time_assert...

Copy first line of a memo field to a text field
I'm setting up a resolutions database where each resolution will be copied from Word documents and pasted into a memo field. The resolution will be in the form: Resolution title <cr> Project no <cr> Date <cr> Meeting Type <cr> Resolution (up to several paragraphs separated by carriage returns etc). eg: Inquiry into sportsground management 35002 20/07/06 Board Meeting "That in relation to this issue we write to xyz, etc..." The resolutions are often quite long and their formatting complex, which precludes converting the memo into a table first up in Wor...