Every now and then I write or modify a matlab function that I need for my research, and will post them to this blog here and there, with the hopes that they will be useful to someone doing antenna/microwave design.  I know, there is the Matlab File Exchange (which is very useful!) , but hey, this is my blog, I want to post my content here.

Below is a function I used to plot smith chart results in matlab.  I used basic plotting code to generate the chart itself, and added a simply plot function to add the impedance locus and constant VSWR circles.  Hope this is helpeful!  Please let me know if anyone finds a bug.  I will note that there is no safeguard in the function for s-parameters that are greater than 1, which if you are plotting the active S-parameters of a multiport device, are possible.  This isn’t a big deal when the S-parameter goes slightly above 1, but if it swings well above 1 you end up with a tiny smith chart and these erratic line segments…it’s a mess.  For passive applications I haven’t come across a bug yet.

smithchart.m


This article from NASA talks about the measurement of magentic portals that connect the earth to the sun every 8 minutes, due to their magnetic fields pushing against each other and forming connections.  It is always interesting to see something happening on a such a large scale and with these huge fields that, as the article points out, many people didn’t believe in only 10 years ago.
I find the interaction of the electromagnetic waves on the scale of the solar system, between immensely large objects (here the earth and the sun) to be fascinating.  I spend so much time dealing with such small scale fields - antennas, microwave circuits, where fields are coerced into existence in these carefully designed structures to behave in a certain way.  Then I read articles on fields stretching 100 million miles between the earth and the sun, or the various effects the sun’s fields have on the earth, such as solar flares - fields covering half our solar system, in unbounded space, whose origins are not always clear or understood.  I mean, the earth’s magnetic field seems such a simple field that we take for granted - yet why it exists in the first place is not fully understood - you can’t exactly cut the earth in half and take a peak at it’s cross-section. It has even been shown to have flipped thousands of times over it’s lifetime - also something that we don’t quite understand the reason for.

I only have one course this semester, focusing on my Probability and Random Processes course and doing research.  This is by design, since I knew probability is a course I haven’t taken in 6+ years now…and I am super rusty.  But I have our text for the class, the schaum’s outline, and 3 other probability and random processes texts, and have been reading like crazy this semester, and doing sample problems out of the 4 texts and schaum’s.  Daily.  It’s good because I am having a much better time with this material than I expected, although the homeworks have been taking a long time to complete.

All this being said, here’s a sign it’s really starting to mess with my life: when I woke up this morning I asked myself what the probability of me getting out of bed when my snooze alarm went off for a third time (it’s set for 10 min intervals).  So I told myself, given how freezing it was in my apartment, and that I didn’t feel particularly awake, that I’d rate the likelihood of me getting out of bed on a given snooze alarm as 2/5, assuming I feel the same way independant of which snooze alarm is going off.

SO to get out of bed at the third snooze would be the probability of 2 failures to get out of bed, again assuming independence to make my just woken life easier, and one success:

P(I get out of bed on third snooze) =  (1-P(I get out of bed on first snooze))*(1-P(I get out of bed on second snooze))*P(I get out of bed on third snooze) = (1-2/5)(1-2/5)(2/5) = 18/125 ~ 20/120 = 1/6 ~slightly below 0.2, I’d say around 0.18 = => 18%

Then I went to sleep again and got out of bed on the 4th snooze alarm.

btw: The probability of me ever getting out of bed on my snooze alarm, found by summing over all probabilities from 1 alarm going off to infinitely many snooze alarm events, is 1, as you’d expect.  So it was bound to happen, eventually…

After spending most of the season in first place, it was looking dicey as it wore down and they slipped into 2nd place last week… but they pulled it off tonight!  Although I would have rather went to the game (as most of my family and friends got some of the tickets for tonights game….man!) than watch in the local bar ( I don’t have cable…) with a bunch of people rooting for minnesota to win, it was a great game.  I listened to half of the game online (it’s the only cheap way to get most their games, having lived outside of chicago for 6+ years now…), and then decided that this wasn’t doing it service, and of course it was on national TV tonight.  Thursday is going to be an interesting day — 1st playoff game vs. Tampa Bay, and the VP debate!

sox.JPG

I got an email informing me that my masters thesis is now accessible through the University of Massachusetts “scholarworks” site, their digital library of thesis and disseratations.

If you are interested in taking a look at what I spent the last two years working on…you can find it  here.

The thesis was on a project aiming to design GPS antennas that fit into a volume of approximately 1.25X1.25X0.2″.

I have been running some Ansoft HFSS simulations of infinite arrays of antennas, recently.  A peculiar thing I noticed is that some of the impedance data, which is calculated from the S-parameter matrices, had sizable spikes (upwards of 300Ohms) inside a frequency band that, from the S-parameters, looked smooth and well matched.  Clearly something was wrong.  A low VSWR and S11 imply impedance levels close to the source impedance, yet these spikes in the impedance were there.

So I decided that, being able to compute all the data I need from S-parameters alone (as HFSS does), I exported the entire S-matrix to MATLAB and took a look at the impedance values I calculated.

HFSS gives the equation for finding the Z matrix as :

Z = sqrt(Zo*I)*inv(I-S)*(I+S)*sqrt(Zo*I)

where I=identity matrix, and S is the full S-parameter matrix

from this I plotted the exact same thing HFSS was giving for the impedances.  So I started plotting different chunks of the equation (e.g. inv(I-s) alone, (I+S) alone…) and found that the inv(I-S) term was spiking at the exact places my impedance was spiking, while the other terms were well-behaved.  Well, looks like that inversion is messing things up…indicating a singular, or more correctly a nearly-singular matrix (singular matrices have NO inverse defined).  Sure enough, using the function:

cond()

in MATLAB revealed huge condition numbers for the matrix (I-S) where the impedance spikes occurred, 2 orders of magnitude larger than the condition numbers calculated over the rest of the frequency sweep.  So I need to invert a matrix that is nearly-singular….now what??  I need single-value-decomposition (SVD) to take out those values that make the matrix singular and do a quasi-inversion, basically approximate the inversion.  MATLAB includes just such a function:

pinv() — where it’s use is  pinv(matrix, tolerance)

The tolerance can be set to an arbitrary value.  For my purposes, I can stand to lose some accuracy, so I chose a relatively large tolerance (around 0.02 or so) to take out those spikes but preserve the overal shape of the impedance waveforms.  Usually you will want to keep this very small to keep the inversion close to the true value.  But this solves my problem.

But it leads to another conclusion — HFSS, apparently, doesn’t test if its S-parameter matrices are nearly-singular (or at least I haven’t seen a way to have it do so).  Certainly it is using all sorts of inversion approximations in the solver the software uses (you can even do iterative matrix solutions in v11 of HFSS…), I don’t think it is likely that they have skimped on such checking on the data output front end.   Please post comments if you konw of any solutions in HFSS for this.

Here is an interesting Java applet that allows good visualization of the fields of some basic antenna elements.

 http://www.falstad.com/antenna/

You can readily see the field pattern distortions that occur from things like making a dipole or loop longer than half a wavelength in size, the multiple lobes that form, and how the current distribution forms on the structure.  You can for from a triangular current distribution on the dipole, to 10 or 20 sine wave variations along the length.  Really easy way to see what happens to the pattern.  There are also some array examples of end-fire arrays and schelkunoff polynomial alrrays.

My friend Bill Whirity (see link to his website on the side) is making a movie (look for his other movie Broke on netflix!…I was supposed to be Eddie Beats but had my wisdom teeth out right before shooting…I digress) called The Misadventures of Milo Weatherby.  From what I have seen of it, it will be awesome.  It is about these two kids and their, well, misadventures with science. They just finished shooting it, so no idea when it will be out.  Here is a great video from it:

http://billwhirity.com/milo/videos/microwave_implosion.mov

Images of the earth and moon from 31 million miles away.

A NASA spacecraft designed to look for comets turned its cameras homeward, capturing a unique view of the moonEarth as seen from 31 million miles away. The spacecraft, Deep Impact, took shots at 15-minute intervals, which were combined to make the sequence shown below. passing in front of the


 

The latest images show the moon and Earth in greater detail than previous ones taken by orbiting spacecraft, showing oceans and continents on our planet and craters on the moon. By studying how Earth looks from so far away, the scientists hope to sharpen their search for alien worlds that may share similar characteristics”

lightning_med.jpg

The last couple days have been full of some nasty, although short-lived storms.  It has been very hot and humid, and so these mid-afternoon/early-evening storms build up.  On friday I was walking home from campus and got caught in the middle of a really, really bad storm.  Tons of lightning nearby, which isn’t good when walking past huge open farm fields, and torrential rainfall, making it hard to see maybe a quarter of a mile down the road.  I was left with thes two options: take the meager shelter offered by the bus stop I came to, and maybe hop on a bus that may be here any minute, or could be up to an hour away from making this stop, or start running.  Noting the amount of lightning and the tiny bus enclosure next to some huge trees, I decided it was unwise to stay at the bus stop.  So I started sprinting the 3/4 mile back to my apartment in the pouring rain, with sandels on, and my macbook in my non-water resistant messenger bag.  I made it back to my apartment, soaking wet, but thankfully my macbook and the contents of my bag were relatively dry.  Also, as soon as I got in the front door of the house my apartment is in, the storm picked up tremendously - both in rain and amount of lightning.  Then the power went out, I actually heard the transformer down the street pop from a lightning hit.  The top half of a huge evergreen tree in my backyard fell over, not sure if it was from the wind or lightning.  Lots of big branches down up and down the block.  Power was out for about 5 hours, and campus lost power over that time too.  This is where my problems actually started.

When the power came on at my apartment, I tried logging into my work comp, which couldn’t because the network was down, and I later found out was off due to the power going out.  So on saturday I ride my bike over to campus to do a little work, which I could have done from home if my computer wasn’t off.  I took the long route to campus beause that route is makes for an interesting ride, and I was in no hurry to get to campus, but when I was halfway there near a farm (which allowed me to see, instead of the tree lined roads), off to the west I can see really dark clouds forming.  “Oh crap”, I thought, I am gonna get caught in another storm.  So I picked up the pace and made it over to campus in time for it to start pouring — even harder than on friday.  And wind like I have never seen here — huge gusts blowing the rain straight sidways.  And while storming pretty bad, the lights dimmed a few times, the emergency lights flickered on for a split second — I then decided it wan’t worth running my computer given the possibility of losing power again or, worse, a surge.  So I unplugged my computers, including the ethernet, and got a ride home from a friend in lab.

So today (sunday), I head over on the bus and intend to restart my computers, and ride my bike back to my apartment.  No storm was on the verge of exploding when I got to lab, so I figured my luck was changing.  Instead, in complete sunshine, the power goes out in our building.  The building next to us had power, but we did not.

So for three days in a row my computer has been down for the count, and I won’t have the simulations I was hoping to have tomorrow, monday.  My luck stinks right now, it turns out!

Next Page »