Month: May 2015

Impedance transformation

May 16, 2015 ece1229 , , , ,

[Click here for a PDF of this post with nicer formatting]

In our final problem set we used the impedance transformation for calculations related to a microslot antenna. This transformation wasn’t familiar to me, and is apparently covered in the third year ECE fields class. I found a derivation of this in [1], but the idea is really simple and follows from the reflection coefficient calculation for a normal reflection configuration.

Consider a normal field reflection between two interfaces, as sketched in fig. 1.


fig. 1. Normal reflection and transmission between two media.

The fields are

\BE^\textrm{i} = \xcap E_0 e^{-j k_1 z}
\BH^\textrm{i} = \ycap \frac{E_0}{\eta_1} e^{-j k_1 z}
\BE^\textrm{r} = \xcap \Gamma E_0 e^{j k_1 z}
\BH^\textrm{r} = -\ycap \Gamma \frac{E_0}{\eta_1} e^{j k_1 z}
\BE^\textrm{t} = \xcap E_0 T e^{-j k_2 z}
\BH^\textrm{t} = \ycap \frac{E_0}{\eta_1} T e^{-j k_2 z}.

The field orientations have been picked so that the tangential component of the electric field is \( \xcap \) oriented for all of the incident, reflected, and transmitted components. Requiring equality of the tangential field components at the interface gives

1 + \Gamma = T
\inv{\eta_1} – \frac{\Gamma}{\eta_1} = \frac{T}{\eta_2}.

Solving for the transmission coefficient gives

&= \frac{2}{ 1 + \frac{\eta_1}{\eta_2} } \\
&= \frac{2 \eta_2}{ \eta_2 + \eta_1 },

and for the reflection coefficient

&= T – 1 \\
&= \frac{2 \eta_2 – \eta_1 – \eta_2}{ \eta_2 + \eta_1 } \\
&= \frac{\eta_2 – \eta_1 }{ \eta_2 + \eta_1 }.

The total fields in medium 1 at the point \( z = -l \) are

\BE^\textrm{i} + \BE^\textrm{r}
\xcap E_0 \lr{ e^{ -j k_1 (-l)} + \Gamma e^{ j k_1 (-l) } }
\BH^\textrm{i} + \BH^\textrm{r}
\ycap \frac{E_0}{\eta_1} \lr{ e^{ -j k_1 (-l)} – \Gamma e^{ j k_1 (-l) }}.

The ratio of the electric field strength to the magnetic field strength is defined as the input impedance

Z_{\textrm{in}} \equiv \evalbar{\frac{E^\textrm{i} + E^\textrm{r}}{H^\textrm{i} + H^\textrm{r}}}{ z = -l}.

That is

\eta_1 \frac{
e^{ j k_1 l} + \Gamma e^{ -j k_1 l }
e^{ j k_1 l} – \Gamma e^{ -j k_1 l }
} \\
\eta_1 \frac{
\lr{ \eta_1 + \eta_2} e^{ j k_1 l} + \lr{ \eta_2 – \eta_1} e^{ -j k_1 l }
\lr{ \eta_1 + \eta_2} e^{ j k_1 l} – \lr{ \eta_2 – \eta_1} e^{ -j k_1 l }
} \\
\eta_1 \frac{
\eta_2 \cos( k_1 l ) + \eta_1 j \sin( k_1 l)
\eta_2 j \sin( k_1 l ) + \eta_1 \cos( k_1 l)

\eta_1 \frac{
\eta_2 + j \eta_1 \tan( k_1 l)
\eta_1 + j \eta_2 \tan( k_1 l )


[1] Constantine A Balanis. Advanced engineering electromagnetics, chapter {Reflection and transmission}. Wiley New York, 1989.

Canada’s ministry of homeland security

May 14, 2015 Incoherent ramblings , , , ,

This last month, I’ve seen one name come up more than any others related to police-state actions and government overreach.  That name is Steven Blaney, the Minister of Public Safety.  He’s the one that sponsored bill C-51, he’s the one who has apparently attempting to arrange for US soldiers to police portions of Canada, and who has recently been caught proposing that groups that opt for BDS bans against Israeli-government actions be prosecuted under hate speech laws.  As Greenwald comments he and the government now both deny the latter.

So what is this Ministry of Public Safety?  That ministry is named in an Orwellian fashion, and contains a number of departments that have a large potential to abuse their power:


Basically, here under one roof is all the capability to spy on Canadians, restrict our rights, and then lock us up if we don’t comply.  It’s like the little sister of the United States Department of Homeland Security, with bits of the NSA and CIA tossed in.  The only thing missing is military power.  The total (declared) budget of this ministry is 6 billion dollars.  Compared to its United States counterparts this is an infinitesimal amount of operating cash, and they want more.

Understanding that “Minister of Public Safety” is a misnomer brings a lot of clarity when you consider that this politician is the one that tabled bill C-51.  Basically that bill is an attempt to grant the police state subset of the Canadian government, run by Blaney, more power.  It would be more accurate to have named this bill the “Please grant my Ministry more power” bill.  It now also makes sense how this bill appeared so quickly after the recent parliamentary shooting.  Blaney isn’t a lawyer, but a civil engineer by trade, so wouldn’t have written this himself.  I’d guess this was written by general-council in his ministry long before this shooting and was held in waiting for just this sort of perfect catalyzing event.  That is, of course, pure speculation.

Interesting news.

As a first look at this Ministry and its head, I did a bit of digging, and found a couple of interesting articles


The first and second are excellent examples of just the sort of overreach and abuse of power that people are concerned that Bill C-51 would allow.  The only disclaimer is that these are events that have already occurred.

This ministry is indirectly responsible for gun controls, the subject of that last article.  I don’t know a thing about guns nor that specific Swiss weapon, but am completely unsurprised that a politician has been caught playing the game of saying things in the press contrary to reality.

Bills tabled by Blaney

What else is the Ministry of Public Safety up to.  Here’s a list of bills tabled by their figurehead:

An Act to amend the Criminal Records Act, the Corrections and Conditional Release Act, the Immigration and Refugee Protection Act and the International Transfer of Offenders Act

An Act to amend the Corrections and Conditional Release Act and to make a consequential amendment to the International Transfer of Offenders Act

An Act to enact the Security of Canada Information Sharing Act and the Secure Air Travel Act, to amend the Criminal Code, the Canadian Security Intelligence Service Act and the Immigration and Refugee Protection Act and to make related and consequential amendments to other Acts

An Act to amend the Canadian Security Intelligence Service Act and other Acts

An Act to amend the Firearms Act and the Criminal Code and to make a related amendment and a consequential amendment to other Acts

An Act to amend the Corrections and Conditional Release Act


This ministry has been busy.


Letter to parliament (John McCallum), thank you for your positive Bill C-51 vote.

May 11, 2015 Incoherent ramblings , , , ,


From: <me, address, date>





The Honourable John McCallum,

House of Commons

Ottawa, Ontario


K1A 0A6


The Honourable John McCallum,


I see at that you voted for bill C-51.  I asked for this in my letter dated April 15, 2015.  However, I thought I should now point out that my original letter was intended to be satire.

Satire has been used historically for political commentary.  This was true for example of Orwell’s “Animal Farm” and “1984”.  Given your vote on bill C-51, it seems clear that the intent of the book “1984” was not clear.  This book was supposed to point out many dangerous trends in society of the time.  It was not supposed to be a manual.

I do not know if your vote for C-51 was due to a belief that this was what your constituents wanted this.  Perhaps you were looking at biased or old polls that indicated this was true?  There would have been a time when the media hype for the parliamentary shootings would have gotten just this sort of reactionary support.  However, once people started behaving rationally again, support for increased police state actions against Canadian citizens should have been a hard sell.

Perhaps you voted for this because you felt obligated to?  Your political party requires consensus views and actions.  For reasons that I’ll never understand, the current figurehead of your political party mandated that you would not be able to vote your own view, let alone the views of your constituents.  I really can’t imagine how you can tolerate being part of such a system.  Did you realize that once elected you would be powerless, and not be given the opportunity to vote for your own views?

How a system where party consensus is required can be called democracy is beyond my understanding.  Perhaps this is because I have a 12-year old mentality.  When I took civics for the first time back in junior school, this concept was just as insane.  Perhaps I am the childish insane one to think that the forces that truly govern behind the curtain would allow things to be any other way.

You as a member of parliament, and I as a citizen of Canada, both know how much of a farce democracy in Canada is.  Once every few years the “people” get to exercise their “free will” electing a representative.  Even if our chosen representative is elected, as many as 49% percent (assuming the ideal of all voting) will be unrepresented.  Those who do get their selection of “representative” are probably compromising on a number of issues, and are really crossing their fingers hoping not to be screwed by the power elite.  Even assuming our representative makes it into their figurehead position, you have no more power to actually represent us than a stick floating upstream.  You have to fight the entrenched bureaucracy of the Federal government, surely an unmovable force.  For that I give you my deepest condolences.

It is my expectation that this positive C-51 vote is going to backfire strongly on both the Conservative and Liberal parties.  Canadians have been shown by the actions of both that they are indistinguishable.  For those that still believe in the concept of modern democracy, you will likely find that this will increase voter apathy.  This bill is just more of the same old crap.  The government is once again voting to give themselves more power.  If that is why you voted for this I guess it makes sense.  It’s sad and demoralizing, but it makes sense.  In essence a positive vote is like a positive vote for a pay raise for government.  Unfortunately, we all have to pay for that raise.  We all have to pay for our own enslavement.  This will probably mean that an NDP Federal figurehead will lead the next round of the show come election times.  I don’t personally believe that it will make any difference.  It may make a difference to you, since you might be forced to get a different job.

Presuming that you did read this or my previous correspondence, I doubt there is anything that you can say that will fight off the feelings of complete betrayal.  I doubt there is anything that you can write that would inspire non-existent believe in Canadian democracy.  I write this as if you will actually read what I say.  I don’t know if that is the case.  Perhaps I am corresponding again with Mr. Nicholson from your office?

Even if you do read this, and even if you do respond, I doubt there is any sort of justification that you can make that I will judge to be in good faith and to be well reasoned.  This is why people don’t want to know what our “leadership” is doing in our names, and do not want to be involved in the Canadian system of government.  It is too depressing to know come face to face with just how pointless and hopeless it is.  Thanks to your vote on bill C-51, perhaps I’ll go back to ignoring what I can’t change, and let myself and my kids become ever more enslaved.






Peeter Joot

Debugging with optimization: -g8

May 8, 2015 C/C++ development and debugging. , , , , ,

It was suggested to me to try -g8 for debugging some optimized code (xlC compiler, linuxppcle platform).  Turns out that there is a whole set of -gN options with the xlC compiler that allow various levels of debug instrumentation.

For the optimization bug that I was debugging, -g8 made the problem go away, but with -g5 I was able to break at the nearest case: block and determine that the data in the variables was good coming into that case statement.  Since what appears to come out of that case statement is bad, this isolates the problem significantly.

Hacking header file timestamps

May 7, 2015 C/C++ development and debugging. , , ,

Suppose you change a header foo.h, but your build system has dependency checking that will force the world to be rebuilt. A handy way to avoid that is with judicious use of the touch command, such as:

touch -t197301010000 foo.h 

or (on Linux)

touch --reference another-file-that-is-early-enough-in-time foo.h

Both of these can be used to force the modification time for the file backwards.

This can be very useful way to save time.

It is also a great way to not build enough or break the build if misused!

I’d recommend this only for prototyping type work, to be followed up with a subsequent touch to restore the timestamps to normal, and then do a proper build.