How to generate a symmetric Toeplitz matrix ?
MATLAB: How to generate a symmetric Toeplitz matrix
symmetric
Related Solutions
Hello Ashmika,
You do have a symbolic solution for h, which goes to show that symbolic solutions are not always the ideal.
There are eight solutions in all. Each one contains, among other things, a roots function, the roots of a 4th degree polynomial in z
roots(z^4 + z^3*A(r,phi) + z^2*B(r,phi) +... D(r,phi), z, k)
where the coefficents A(r,phi) etc are complicated functions of r and phi. Here z is just a dummy variable, and the roots are determined by the coefficients A,B,C,D. Four distinct roots are indicated by cycling k through 1,2,3,4 as you can see at the end of each of the first four very long lines of code.
That's four solutions. The other four solutions have the same values for the roots, the only difference being that the expression at the beginning of each line
2*r^2*cos(phi + pi/3)
has positive sign for the first four solutions and negative sign for the last four solutions.
The four roots are merely indicated by the index k. Since this is a polynomial of degree four, it is possible to write each of the four roots explicitly in terms of A,B,C,D but if you think you have long expressions now, those expressions might be several times longer.
A symblic expression that takes up a page of text begins to lose its effectiveness. You can still do calculaton by plugging values or even more symbolic epressions into them, but at some point one might consider just doing a numerical calculation from the beginning.
You are not passing theta_n and other parameters to root2d(). One fix is to make root2d a Nested Function. Also, you must choose a different initial point. phi0 = [10,10] worked for me.
function solve_it() beta_a = 10; alpha_n = 10 ; eta= 18; i = 18; theta_i = 10; theta_n = 10 ; fun = @root2d; phi0 = [10,10]; phi = fsolve(fun,phi0); phi_n = phi(1), phi_i = phi(2), function F = root2d(phi) F = zeros(2,1); F(1) = (pi*sin((pi*(phi(1) + theta_n))/180)*cos((pi*phi(2))/180)*(cos((pi*theta_n)/180) + tan((pi*i)/180)*tan((pi*theta_i)/180)))/(180*sin((pi*phi(1))/180)*(cos((pi*(phi(1) + theta_n))/180)*cos((phi(2)*pi)/180) + sin((phi(2)*pi)/180)*tan((theta_i*pi)/180))^2) - (pi*cos((pi*phi(1))/180)*(cos((pi*theta_n)/180) + tan((pi*i)/180)*tan((pi*theta_i)/180)))/(180*sin((phi(1)*pi)/180)^2*(cos((pi*(phi(1) + theta_n))/180)*cos((pi*phi(2))/180) + sin((pi*phi(2))/180)*tan((pi*theta_i)/180))); F(2) = ((cos((pi*theta_n)/180) + tan((pi*i)/180)*tan((pi*theta_i)/180))*((pi*cos((pi*(phi(1) + theta_n))/180)*sin((pi*phi(2))/180))/180 - (pi*cos((pi*phi(2))/180)*tan((pi*theta_i)/180))/180))/(sin((pi*phi(1))/180)*(cos((pi*(phi(1) + theta_n))/180)*cos((phi(2)*pi)/180) + sin((phi(2)*pi)/180)*tan((theta_i*pi)/180))^2); endend
Best Answer