Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: How to improve this with Matlab vectors
Replies: 4   Last Post: Oct 14, 2011 2:16 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Jeff

Posts: 113
Registered: 11/22/09
How to improve this with Matlab vectors
Posted: Oct 13, 2011 1:40 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Can someone give an example of how to write this using Matlab's vectorizing? I'm sure there's a better way than what I have, but I can't quite get it working. I tried fooling around with meshgrid and stuff, but I just keep getting wrong results or 'mtimes' and 'mpower' errors.

function xfrm=Fxfrm(N)
% N is positive integer (usually a power of 2).
omega=exp(-2*pi*1i/N);
xfrm=ones(N);
for m=1:N
for n=1:N
xfrm(m,n)=omega^((m-1)*(n-1));
end
end
end



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.