Matlab tips and tricks

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 ...

转载于:https://www.cnblogs.com/VVingerfly/p/4722464.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值