码迷,mamicode.com
首页 > 其他好文 > 详细

Matlab tips and tricks

时间:2015-08-11 23:12:10      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:

matlab tips and tricks and ...

page overview:

I created this page as a vectorization helper but it grew to become my annotated Matlab reading cache. In order to motivate the DSP people out there, I am showing below how one can apply a window and scale factors on a pre-framed signal using no loops and minimal memory.

% For framing use buffer() or your own favorite
% Frame length: 256, Number of frames: 10000
X = randn(256,10000);
% Make a window (same for each frame)
w = hamming(256);
W = diag(sparse(w));
% This is the windowed signal, without loops
XW = W * X;
% Make a vector of random gain factors (one per frame)
g  = rand(10000,1);
G  = diag(sparse(g))
% Now lets scale each frame by the corresponding gain factor
XG = X * G;
% Windowing and gain scaling is just left and right product with a diagonal.
XWG = W * X * G;

 

local links:

Note that some of the following documents are taken off of Mathworks‘ own support site; more specifically take a look at the technical notes section.  Also a very good source of information is comp.soft-sys.matlab

 

文章转载自 marios athineosmatlab tips and tricks and ...

Matlab tips and tricks

标签:

原文地址:http://www.cnblogs.com/VVingerfly/p/4722464.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!