MATLAB: How to right x^2 in MATLABMATLABi trying to do some equetion and i come up with an erro message every time i right it out Best AnswerIs x a scalar? If so, then you write it as x^2. Is x a vector? Then, assuming you want to perform an element-wise squaring, you use x.^2. If you are asking this question, you REALLY need to be reading the getting started tutorials - the Onramp tutorials are a good place to start. There are also multiple MATLAB tutoring sessions on Youtube to watch. Finally, when you get an error. then show what you did. Show the COMPLETE error message, thus everything in red. Otherwise we need to make wild guesses as to what you did wrong.