From: Matt Fig on 7 Aug 2010 16:48 "Mohammad " <jaber2(a)uni.uiuc.edu> wrote in message > Thanks everyone. Just for educational purpose (So I can do this in the future) does the x(:) mean that x is changing, and what does the .' after Star signify. > > THANKS! this made my program a whole lot simpler. > > Cordially, Mohammad Look doc colon doc transpose
From: Roger Stafford on 7 Aug 2010 16:57 "Mohammad " <jaber2(a)uni.uiuc.edu> wrote in message <i3ka4b$cd0$1(a)fred.mathworks.com>... > "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <i3k630$8dp$1(a)fred.mathworks.com>... > > "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i3k4eg$qp0$1(a)fred.mathworks.com>... > > \> v=@(x) sum( bsxfun( @times, sin( pi*x(:)*(1:r) ),Star) , 2 ).'; > > - - - - - - - - - - - > > You don't need bsxfun for this one: > > > > v = @(x) sin(pi*x(:)*(1:r))*Star.'; > > > > Roger Stafford > > Thanks everyone. Just for educational purpose (So I can do this in the future) does the x(:) mean that x is changing, and what does the .' after Star signify. > > THANKS! this made my program a whole lot simpler. > > Cordially, Mohammad - - - - - - - - - No, x(:) makes a column vector out of the elements of x just in case your x was a row vector. (Actually it will make a column vector out of a matrix too.) The .' after Star takes its transpose. This is necessary so that the number of columns in sin(pi*x(:)*(1:r)) will equal the number of rows in Star.' and yield a valid matrix multiplication with the * operation in between them. You should read up in your matlab manual about indexing and matrix multiplication. It's an important part of one's matlab education. Roger Stafford
First
|
Prev
|
Pages: 1 2 Prev: pcolor and contour on same axis Next: slow class property access problem and solution |