help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stack and append


From: Eduardo Gallestey
Subject: Re: stack and append
Date: Wed, 16 Jun 1999 17:37:36 +1000

This "kron.m" should work better than the previous one.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function x =kron (a, b)
 
  if (nargin == 2)
    
    [m, n] = size (b);
    [ma, na] = size (a);
    
    x=zeros(ma*m,na*n); 
    i_vec=1:m;
    j_vec=1:n;

    for jj = 1:na
      for ii = 1:ma
        x(i_vec+(ii-1)*m,j_vec) = a(ii,jj)*b;
      endfor
      j_vec+=n;
    endfor
    
  else
    usage ("kron (a, b)");
  endif

endfunction

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Cheers,
Eduardo



---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.  To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]