MATLAB: I’ve been having this error, and I really don’t know why. Can someone help me? I’m using R2017B with Mac OS.

error

2ˆ3
Error: The input character is not valid in MATLAB statements or expressions.

Best Answer

Because that is not the exponentiation character. Yes, it looks that way.
2ˆ3
2ˆ3
Error: The input character is not valid in MATLAB statements or expressions.
So what is the ascii value for that character?
+'2ˆ3'
ans =
50 710 51
It comes out as 710, which is not actually not in the ascii set, but beyond that.
+'^'
ans =
94
NOT the 94 that we expect.
So somehow, you managed to get the wrong character set in there, because when I type this on my Mac:
2^3
ans =
8
it works fine.
If I had to guess, it looks like you copied something from a text document, one that was using a different character set.