Logbook is right: 377 ohms is the impedance of free space. It is actually the square root of the permitivity of free space over the permability of free space, or:
Z0 = sqrt(mu0 / eps0) = 377 ohms (approximately)
The permitivity and permbility are more fundamental concepts than the impedance.
Logbook is right. You are going to end up cooking yourself if you don't figure out what you are doing before you try stuff.
The bible for magnetrons is by Collins in the MIT RadLab series. If you are a student, you can get the whole series on CD for a reasonable price. There is another...
If you are leaning towards Matlab, you should consider Python with numpy and matplotlib. They can handle nearly everything that Matlab can, as long as you aren't interested in the plugins (symlink, etc).
As an added advantage, Python is a much more general language than Matlab, so you may find...
I haven't used Matlab in a while, but something like this should work (for 100 points of p between 1 and 15, and for 50 points of q between 10 and 20):
p = linspace(1,15,100)
q = linspace(10,20,50)
for x = 1:length(p),
U[:,x] = ln(1./q) - cos(p[x])
end
plot3d(p,q,U)
Do you need an analytic formula for the result? If so, you are problably best to just do the math, or, if you are lazy, use Mathematica or Maple. But unless the circuit is a lot more complicated than your example, you really don't need them.
If you don't need an analytic result, just a...