MATLAB: [Error using char] How to solve a transcendental equation for given variables

char

This is my code which enabled a graph to be plotted.
s = 'F/(11*((0.8*10^-3)^2)*2.41*10^9)= sin(x)*((cos (18.97)/cos (x))-1)^1.5';
ezplot(s , [5 10 15 20])
This is the code which gave the following error.
*Error using char Complex values cannot be converted to chars
Error in solve>getEqns (line 245) vc = char(v);
Error in solve (line 141) [eqns,vars,options] = getEqns(varargin{:});*
//Defining variables
a =5;
b=13;
c=1*10^-3;
d=0.57*10^-3;
e = 0.57*10^-3;
f=0.02*10^-3;
g = d/c+e/c-1;
h = acos(1 - f/(2*g*c));
i = 6*(10^6)*g^2+3*(10^6)*g*6894.75729;
//Transcendental function
k= '(a/(b*(c^2)*i) = (sin(j)*((cos(h))/(cos(j))-1)^1.5)';
ezplot(k, [5 10 15 20]);
The concern I have is the error only appears when I change the value within the function into a defined variable (e.g a,b,c)
What am I doing wrong and how do I correct this?

Best Answer

When you pass a string, values you have set in the workspace are not used. So the "i" you defined as a real value will not be paid attention to and instead "i" will have its default meaning as the imaginary constant, sqrt(-1)
Try
k= @(j) (a/(b*(c^2)*i) - (sin(j)*((cos(h))/(cos(j))-1)^1.5);