# MATLAB: Defining Variables

defineunknownvariables

Hi, I'm a fairly new user of Matlab, and I set up a list of variable definitions like so:
n0=1;
n21=1.694;
n22=1.7046;
n23=1.7152;
k21=3.666;
k22=3.7066;
k23=3.7274;
y1=250;
y2=251;
y3=252;
z=(n-1i.*k);
w1=(n21-1i.*k21);
w2=(n22-1i.*k22);
w3=(n23-1i.*k23);
a1=((n0-z)./(n0+z));
a2=((n0-z)./(n0+z));
a3=((n0-z)./(n0+z));
b1=((z-w1)./(z+w1));
b2=((z-w2)./(z+w2));
b3=((z-w3)./(z+w3));
c1=((4.*pi)./y1);
c2=((4.*pi)./y2);
c3=((4.*pi)./y3);
R1=.922269;
R2=.92401;
R3=.925751;
This list is used to define variables for these 3 equations to be solved simultaneously:
fcns(1)=R1+(b1.*exp(c1.*1i.*d.*z).*((R1.*a1)-1))-a1;
fcns(2)=R2+(b2.*exp(c2.*1i.*d.*z).*((R2.*a2)-1))-a2;
fcns(3)=R3+(b3.*exp(c3.*1i.*d.*z).*((R3.*a3)-1))-a3;
When I run the .m file, however, I get an error at z=(n-1i.*k) saying that n is an 'undefined variabe'. n is supposed to be undefined, as I solve for it later. How can I resolve this? Also, is there a way to put Matlab code into these entries to help organize them?

``syms n``
``doc fsolve``
``web([docroot '/techdoc/ref/function_handle.html'])``