First, when you have a question about an error, report the entire error, that which is written in red in the command window.
When I try to execute the code you supply, I get this:
eqn = ((e1/(ex(y^2-e1*ko^2)^0.5))+i(sigma/(2*(pi)*w0*ex*eo)))*(y^2*(ex/ez)-ex*ko^2)^0.5 == -coth((d/2)*(y^2*(ex/ez)-ex*ko^2)^0.5);
Error using sym/subsindex (line 845)
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must
be sym expression.
That pushes me to read the line of code that failed. You should learn MATLAB syntax.
Is "i" a function? No. It is the imaginary constant, sqrt(-1).
When you write this i(stuff), MATLAB assumes that you have defined a function called i. So you get an errror, because i is a variable.
The same thing applies to ex, where you failed to provide an operator. This line executes without an error now.
eqn = ((e1/(ex*(y^2-e1*ko^2)^0.5))+i*(sigma/(2*(pi)*w0*ex*eo)))*(y^2*(ex/ez)-ex*ko^2)^0.5 == -coth((d/2)*(y^2*(ex/ez)-ex*ko^2)^0.5);
Of course, you need to know that no analytical solutiobn to your problem can exist. So solve will give up and use a numerical solver - vpasolve. And vpasolve, with the default strting value, may or may not find the solution that you want to see.
Anyway, the garbage answer that solve/vpasolve does find...
Warning: Unable to solve symbolically. Returning a numeric solution using vpasolve.
> In solve (line 304)
- 2832015.543898071889729601355261711441252 - 209003.8218923036774138338517475746314398i
That is clearly in the wees, since if a solution does exist, I might expect it to be on the order of 1e-10 or so, just by looking at your expression.
2 / 2.0922e-13 \ 2
sqrt(1.692 y - 6.0238e-22) | --------------------- - 1.8257e-6 + 2.6898e-7i | == -coth(4.0e-8 sqrt(1.692 y - 6.0238e-22)) 1.0
| 2 |
\ sqrt(y - 1.2603e-34) /
So before you do anything, you SHOULD plot your function. First, re-write it as:
eqn = ((e1/(ex*(y^2-e1*ko^2)^0.5))+i*(sigma/(2*(pi)*w0*ex*eo)))*(y^2*(ex/ez)-ex*ko^2)^0.5 - (-coth((d/2)*(y^2*(ex/ez)-ex*ko^2)^0.5));
I predict you will find there are problems with this expression, in terms of finding a solution.