[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with dafault value
From: |
jnna |
Subject: |
Problem with dafault value |
Date: |
Sun, 7 Dec 2014 05:59:23 -0800 (PST) |
Dear All,
I have an awful problem. I didn't use GNU before so I have no idea what to
do to fix it. The thing is I got a code to plot something but it gives me
all the time this error: no default value for argument 1. It calculates Kz
values and then I see this error.
Here is the original code
(http://en.wikipedia.org/wiki/Plane_wave_expansion_method, I already change
something with freqs).
As I said, I didn't use it before, it's not Octave-worksheet plus I got this
code so this suppose to be easy task but it's not. If anyone can fix this
mistake for me, I would be really really grateful.
%
% solve the DBR photonic band structure for a simple
% 1D DBR. air-spacing d, periodicity a, i.e, a > d,
% we assume an infinite stack of 1D alternating eps_r|air layers
% y-polarized, z-directed plane wave incident on the stack
% periodic in the z-direction;
%
%parameters
d=8; %air gap
a=10; %total periodicity
d_over_a = d/a;
eps_r =12.2500; %dielectric constant, like GaAs,
% max F.S coefs for representing E field, and Eps(r), are
Mmax=50;
% Q matrix is non-symmetric in this case, Qij != Qji
% Qmn = (2*pi*n + Kz)^2*Km-n
% Kn = delta_n / eps_r + (1 - 1/eps_r)(d/a)sinc(pi.n.d/a)
% here n runs from -Mmax to + Mmax,
freqs= ();
for Kz=-pi/a:pi/(10*a):+pi/a
Q=zeros(2*Mmax + 1);
for x=1:2*Mmax+1
for y=1:2*Mmax+1
X=x-Mmax;
Y=y-Mmax;
kn=(1 -1/eps_r)*d_over_a.*sinc((X-Y).*d_over_a) +
((X-Y)==0)*1/eps_r;
Q(x,y)=(2*pi*Y/a + Kz).^2*kn;
end
end
fprintf('Kz = %g\n',Kz)
omega_c=eig(Q);
omega_c=sort(sqrt(omega_c));%important step.
Freqs=(omega_c);
end
close()
figure()
hold on
idx=1;
for idx=1:length(-pi/a:pi/(10*a):+pi/a)
plot(-pi/a:pi/(10*a):+pi/a,freqs(:,idx),'.-')
end
hold off
xlabel('Kz')
ylabel('omega/c')
title(sprintf('PBG of 1D DBR with d/a=%g, Epsr=%g',d/a,eps_r))
--
View this message in context:
http://octave.1599824.n4.nabble.com/Problem-with-dafault-value-tp4667712.html
Sent from the Octave - General mailing list archive at Nabble.com.
- Problem with dafault value,
jnna <=