When 'x' is a vector or a matrix, just writing something like
x^2
makes matlab think you want to square a matrix, which is only possible with square matrices. If you have a row vector, then you have a 1 x N matrix, so unless N = 1, you don't have a square matrix, and you get an error. If you merely want to square each entry in x, then you use the " .^ " operator to indicate point-by-point operations (such as division, multiplication, or raising to a power). Whether you need the "dot" before the symbol (/ * or ^) depends on what you're doing. From the looks of it to me, you need the dot if you have a row vector that you only want to use to simulate continuous time.
Luke
Main Topics
Browse All Topics





by: YANKAUSKASPosted on 2008-07-11 at 11:38:10ID: 21984849
Why in this code below, we don't have to use the period before ^?
Select allOpen in new window