MATLAB: How Can I solve a system of eight exponential equations

equationmatrixnonlinearsystem

I want to solve 8 coefficients (variables) and this is what I have written – but it doesn't work!
I would really appreciate it if anyone could help because this is very urgent (I am writing this for my maths paper).
syms=a b c d e f g h
eqn1 =[a+b+c+d+e+f+g+h == 0.2165];
eqn2=[a+b*exp(2*pi*i/8)+c*exp(4*pi*i/8)+d*exp(6*pi*i/8)+e*exp(8*pi*i/8)+f*exp(10*pi*i/7)+g*exp(12*pi*i/8)+h*exp(14*pi*i/8) == 0.8321];
eqn3=[a+b*exp(4*pi*i/8)+c*exp(8*pi*i/8)+d*exp(12*pi*i/8)+e*exp(16*pi*i/8)+f*(20*pi*i/8)+g (24*pi*i/8)+h*exp(28*pi*i/8) == 0.7835];
eqn4 =[a+b*exp(6*pi*i/8)+c*exp(12*pi*i/8)+d*exp(18*pi*i/8)+e*exp(24*pi*i/8)+f*exp(30*pi*i/8)+g*exp(36*pi*i/8)+h*exp(42*pi*i/8)== 0.5821]
eqn5 =[a+b*exp(8*pi*i/8)+c*exp(16*pi*i/8)+d*exp(24*pi*i/8)+e*exp(32*pi*i/8)+f*exp(40*pi*i/8)+g*exp(48*pi*i/8)+h*exp(56*pi*i/8)== 0.2165];
eqn6=[a+b*exp(10*pi*i/8)+c*exp(20*pi*i/8)+d*exp(30*pi*i/8+e*exp(40*pi*i/8)+f*exp(50*pi*i/8)+g*exp(60*pi*i/8)+h*exp(70*pi*i/8)== -0.5821];
eqn7=[a+b*exp(12*pi*i/8)+c*exp(24*pi*i/8)+d*exp(36*pi*i/8)+e*exp(48*pi*i/8)+f*exp(60*pi*i/8)+g*exp(72*pi*i/8)+h*exp(84*pi*i/8)== -1.2165];
eqn8=[a+b*exp(14*pi*i/8)+c*exp(28*pi*i/8)+d*exp(42*pi*i/8)+e*exp(56*pi*i/8)+f*exp(70*pi*i/8)+g*exp(84*pi*i/8)+h*exp(98*pi*i/8)== -0.8321 ]
Thank you!

Best Answer

E.g.,
h = 0:7;
A = bsxfun(@(x,y)exp(x*y*pi*1i/8),2*h',h); % Form your equation matrix
y = [0.2165 0.8321 0.7835 0.5821 0.2165 -0.5821 -1.2165 -0.8321]'; % the rhs
x = A\y; % solve A*x=y for x
The a,b,c etc values are in the vector x.