MATLAB: Error using str2sym (line 83) Unable to convert string to symbolic expression: L 1 (C 103): BADCH: Invalid character(s).

str2sym

Hi everyone, I am unsuccessful in converting string to symbolic expression on this code:
https://www.dropbox.com/s/xuauj97inby8o5m/IntegratedModelAnalytical.m?dl=0
What can I do?

Best Answer

You are using the Unicode ‘En Dash’ (decimal 8211, hex 2013) instead of a normal hyphen (decimal 45, hex 002D) for your minus and negation signs.
You also have a ‘hanging’ negative:
Eq1 = ('n + 2*d -((e*6.24*n)/(n^2 +6.24*n + 6.24*5.68e-5))- 2*((e*6.24*5.68e-5)/(n^2 + 6.24*n + 6.24*5.68e-5))–((h*1.7e-3*n)/(n^2 + 1.7e-3*n + 1.7e-3*6.55e-8))– 2*((h*1.7e-3*6.55e-8-)/(n^2 + 1.7e-3*n + 1.7e-3*6.55e-8))- 5.3e-8/n=0');
(SCROLL RIGHT) ↑ ← HERE
The correct version is:
Eq1 = 'n + 2*d - ((e*6.24*n)/(n^2 + 6.24*n + 6.24*5.68e-5)) - 2*((e*6.24*5.68e-5)/(n^2 + 6.24*n + 6.24*5.68e-5))-((h*1.7e-3*n)/(n^2 + 1.7e-3*n + 1.7e-3*6.55e-8)) - 2*((h*1.7e-3*6.55e-8)/(n^2 + 1.7e-3*n + 1.7e-3*6.55e-8)) - 5.3e-8/n=0';
There are other problems. I will let you solve them.