Using solve function in order to solve 2 equation with 2 uknowns

Hello,
I've tried to solve the 2 following equations:
n0^2*kx*tan(kx*a-(p-1)*pi/2)-n1^2*gx=0
gx^2+kx^2-k0^2*(n1^2-n0^2)=0
for the unknown kx and gx. all the other symbols are known parameters.
I've used the following code:
syms kx gx n0 n1 p a k0
[kx,gx]=solve(n0^2*kx*tan(kx*a-(p-1)*pi/2)-n1^2*gx, gx^2+kx^2-k0^2*(n1^2-n0^2))
It didn't work well. Can someone help?
David

2 Comments

I've run your code and there is no problem!
kx =
(- gx^2 + k0^2*n1^2 - kx^2)^(1/2)/k0
-(- gx^2 + k0^2*n1^2 - kx^2)^(1/2)/k0
gx =
(2*(atan((gx*k0^2*n1^2)/(kx*(gx^2 - k0^2*n1^2 + kx^2))) + a*kx))/pi + 1
(2*(atan((gx*k0^2*n1^2)/(kx*(gx^2 - k0^2*n1^2 + kx^2))) + a*kx))/pi + 1
any message from matlab?
It is not good solution: the solutions for kx and gx are still function of kx and gx. I want to get a solutiona in which kx and gx are functions of n0 n1 k0 a and p.

Sign in to comment.

Answers (2)

I think you need to include the two variables you regard as unknown as arguments in the 'solve' function. Otherwise it has no way to know which are the unknowns. See its documentation.
There will be a number of solutions, in pairs, spaced approximately Pi/a apart, confined to the range kx in +/- sqrt(k0^2*n1^2-k0^2*n0^2). (This does imply that with a chosen "a", you could reduce it down to a single pair of solutions... I would have to look further to see if there are circumstances under which there would be no solutions at all.)

Categories

Tags

Asked:

on 11 Nov 2013

Answered:

on 11 Nov 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!