From: Baris on 31 Jan 2007 19:41 Hi all, How do you construct this following in Matlab?? and for the similar probs in what way should i think? 0 0 0 0 1 0 0 0 1 2 0 0 1 2 3 0 1 2 3 4 1 2 3 4 5 thanks in advance! Baris
From: us on 31 Jan 2007 19:53 Baris: <SNIP mat-gymnastics 101... one of the very many solutions n=5; m=rot90(tril(toeplitz(1:n,1:n)),1) us
From: Jos on 1 Feb 2007 06:09 Baris wrote: > > > Hi all, > > How do you construct this following in Matlab?? and for the > similar probs in what way should i think? > > 0 0 0 0 1 > 0 0 0 1 2 > 0 0 1 2 3 > 0 1 2 3 4 > 1 2 3 4 5 > > thanks in advance! > > Baris The following functions are handy in this case: TOEPLITZ, HANKEL, TRIL, TRIU, FLIPDIM, ROT90 For instance, n = 5 ; rot90(hankel(n:-1:1),2) For a similar problem see <http://newsreader.mathworks.com/WebX/.ef4b523?50@@> By the way, the following seems to be a "bug" (at least in R13) flipdim(hankel(n:-1:1),[1 2]) Warning: Input arguments must be scalar. Warning: Colon operands must be real scalars. although it produces the desired result. Jos
From: cal on 6 Feb 2007 03:57 > How do you construct this following in Matlab?? and for the > similar probs in what way should i think? > 0 0 0 0 1 > 0 0 0 1 2 > 0 0 1 2 3 > 0 1 2 3 4 > 1 2 3 4 5 really easy: >> cumsum(cumsum(fliplr(eye(5))))
|
Pages: 1 Prev: Using pack in a function or a script Next: mvncdf in MATLAB 7.3.0(R2006b) |