To square the difference between x and y in Matlab, you can use the following arithmetic operation:
main.m20 chars2 lines
This will subtract y from x, and then square the result. The value will be stored in the variable result.
Alternatively, if you want to square each element of the variable (i.e., if x and y are vectors or matrices), you can use the . operator to perform element-wise squaring:
main.m21 chars2 lines
This will subtract y from x element-wise, and then square each element.
gistlibby LogSnag