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: 10
X = randn(256,10);
% 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(10,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

  • MATLAB Tensor Toolbox, 2005-12-07
    Just as I was about to bite the bullet and write it myself, I finally came across a class for multidimensional tensors. The original page describing the toolbox can be found hereand the code here.  If you are working with multi-linear forms you will definitely appreciate this.
  • GUI with MATLAB, 2005-06-15
    A presentation on how to get started with GUIs.
  • Good MATLAB Programming Practices for the Non-Programmer, 2005-06-15
    Some simple suggestions.
  • Writing Fast MATLAB Code, 2005-04-23
    Once again your regular collection of standard tricks.
  • MATLAB Programming Style Guidelines, 2005-04-23
    Not that you will ever start writing with such style but here is a bunch of suggestions.  Well on page 9 it reads "Avoid cryptic code",  well I don't think so.  Can you deny that x'.'is so much more beautiful than conj(x) ???  I always prefer the second cause it's so easy to type ... ;)
  • MATLAB Tips and Tricks, 2005-04-23
    We share the same name.  A collection of a lot rather straightforward code.  Take a look, you might find what you are looking for or might not ...
  • Why does LPC return a different prediction error than ARYULE?, 2004-03-16
    This Matlab bug has caused me hours of frustration. Petr Fousek suffered too ...
  • MEX-files Guide, 2004-03-04
    I still don't know if it is possible to operate 'inplace' on a mex array. Do I really need to reallocate memory for output?
  • Why do I receive a segmentation violation mentioning the toolbox cache when starting MATLAB?, 2004-03-03
    Well you got to love this line: "Some customers have found that updating the driver for your video card can resolve the problem as well." Remember that we are talking about an XML toolbox cache file corruption ...
  • Numerical Computing with MATLAB, (pdf cached), (code cached), 2004-02-20
    A very good read. Most of the chapters of the book along with the code are available online.
  • MATLAB Array Manipulation Tips and Tricks (pdf cached), (code cached), 2003-06-14
    Again a very good read.
  • Floating Point, IEEE Standard unifies arithmetic model (pdf), 2003-06-14
  • Why do I receive errors when overloading SUBSREF for types {} and . for MATLAB OOPS objects (31436) (pdf), 2003-06-11
    If you have ever tried to write your own classes in Matlab chances are you run into the problems described in this article.
  • Simplify your code with comma-separated lists (pdf), 2003-06-08
    Two very valuable cases are presented. The first is the fftshift() function which is all you need to know about the most flexible indexing method in Matlab. When you really understand fftshift() take a look at flipdim() and you are done. The second is the problems with subsref() / subsasgn() and the overloaded numel() functions in user-designed classes.
  • What's the big deal ? (pdf), 2003-06-08
    The two main uses of deal are explained:
    [C{:}]   = deal(S.name); % The only way to initialize cell arrays
    [S.name] = deal(C{:});
  • Exploiting the comma-separated list (pdf), 2003-06-08
    There is no exploiting going on here. This is a very easy reading.
  • Think Globally, Act Locally (pdf), 2003-06-08
    A nice pattern for variable number number of input arguments is mentioned.
    function heatmodel(varargin)
    defaultValues              = {100,72,350};
    nonemptyIdx                = ~cellfun(慽sempty�,varargin);
    Technorati 标记:

    defaultValues(nonemptyIdx) = varargin(nonemptyIdx);
    [sz normalTemp hotTemp]    = deal(defaultValues{:});
  • Picking up the Pace with the MATLAB profiler (pdf), 2003-06-08
    Some pretty interesting optimization tricks like the use of 1i variable, loop variable confinement and unrolling of complex arithmetic. Had MathWorks done this for all those cryptic "x" messages in profiler life would be easier ...
  • Is it possible to run MATLAB in the background under UNIX ? (86) (pdf), 2003-06-04
    Guess what? It is!
  • Techniques for Debugging MATLAB M-files (1207) (pdf), m-files (zip), 2003-05-13
    If you are a newbie and you're having problems with basic errors download the above m-files. Chances are your error is identified and solved in one of the examples.
  • What Is the EVAL Function, When Should I Use It, and How Can I Avoid It ? (1103) (pdf) 2003-03-19
    Info about the dreaded triple quotes ''' in eval(). A really nasty way to disable quote's special functionality. In other languages one would expect to escape the quote by \' but not in Matlab. What you really need to know is that:
    >> eval('disp(''''''This is a string'''''')')
    'This is a string'
  • Is it possible to call a dynamic linked library from MATLAB ? (33513) (pdf), m-files (exe) 2003-03-09
    Now one can simply wrap her code in a DLL and have it called from Matlab. Pointers to any type of Matlab variables can be defined straight in the workspace and can be passed to C/C++. Call by reference is now possible.
  • Printing and Exporting Guide (1206) (pdf) 2003-02-27
  • Exporting Figures for Publication B (pdf), m-files (zip) 2003-02-27
    Use this library in your next LaTeX paper ...
  • Matrix Indexing in Matlab (pdf)
  • Memory management guide (1106) (pdf)
  • Accelerating Matlab (R13) (pdf)
    The new version of Matlab uses Just-In-Time code generation. Your for loops have never been that fast !
  • Fast manipulation of multi-dimensional arrays in Matlab (pdf)
    (Older version here)
  • How do I vectorize my code ? (1109) (pdf)
  • Matlab array manipulation tips and tricks (pdf)
    See up for the newest version of this document.
  • Matlab Tricks (pdf)
  • comp.soft-sys.matlab.faq (pdf)
  • Vectorization (pdf)

 

文章转载自 marios athineos 的 matlab tips and tricks and ...。

更多相关文章
  • Android Studio tips and tricks 翻译 这里是原文的链接. 正文: 如果你对Android Studio和IntelliJ不熟悉,本页提供了一些建议,让你可以从最常见的任务和效率增强特性开始使用. 生产力的捷径 Android Studio包含了一系列幫助你提高编码生产力 ...
  • LoadRunner AJAX TruClient协议Tips and Trickshttp://automationqa.com/forum.php?mod=viewthread&tid=2851&fromuid=
  • 原文链接:http://www.if-not-true-then-false.com/2011/nginx-and-php-fpm-configuration-and-optimizing-tips-and-tricks/ I wrote before a guide Howto install N
  • WWDC筆記:2011 Session 125 UITableView Changes, Tips and Tricks
    What’s New Automatic Dimensions - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section CGFloat UITableViewAutomati
  • https://www.hex-rays.com/products/decompiler/manual/tricks.shtml First of all, read the troubleshooting page. It explains how to deal with most decomp
  • 我们知道,微软宣布于10月25日发布RTM版Vista.为了让Windows Vista更好的为用户服务,微软推出该网站提供了一些Vista使用提示和技巧信息及工具,其中主要的内容还是以介绍Vista的使用.目前,该
  • 原文链接:http://www.if-not-true-then-false.com/2012/php-apc-configuration-and-usage-tips-and-tricks/3/   This PH
  • Android Studio 100 tips and tricks
    本文是想总结一些Android Studio的使用技巧,对于大多数习惯了使用eclipse的人来说,可能会须要一段时间,可是假设看过以下的一些介绍,你就能体会到Android Studio的强大之处了,只是本文列举的也仅仅是冰山一角,深入了解后会有很多其它值得你发现的! ps:因为时间关系,翻译可能 ...
一周排行
  • UICollectionViewController
    为了增强网格视图开发.从iOS6开始,就开放集合视图API(collectionView)
  • 本来想等决赛公布后写题解的,奈何过去一星期了官方一点动静也没有,那干脆就写成记事吧. 只打算发在博客园和csdn,不打算发在空间.     --   记得在省赛结束后,4月份,院书记召开了一次赛后总结会.那时的成绩还
  • Application and Progarmming Models 大多基于Silverlight的应用程序都被写在托管代码中并且使用用了Silverlight应用程序模型.然而 你可以选择(option)使用一个
  • 


    		    CCNA第二學期中文final
    1 请参见图示. 对于发往 192.168.2.0 的数据包,R2 会采取什么操作? 它会 ...
  • UVA 11733	 Airports
    最小生成树,然后看他有多少个连通分量,每个连通分量有个飞机场,最后看所有剩下的边是否有大于
  • 新进一WDR7500 居然不能解析花生壳. 百度一番, 发现别人有同样的问题. 找来找去从别人的只言片语中发现需要升级固件. 好不容易加入一个群, 把固件下下来. 升级固件, 重新设置, 解析成功. 不敢独享.  
  • self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.
  • HDU 1978 How many ways(DP)
    题意  中文  但要注意小于你能量的点也是能到达的 令d[i][j]表示到达第i行第j列的
  • 


    		    ospf鏈路備份《2010年全國職業院校技能大賽試題》
    本文出自 "户天生的博客" 博客,请务必保留此出处http://hut ...
  • c++14中将包含一个std::optional类,它的功能和用法和boost的optional类似.optional<T>内部存储空间可能存储了T类型的值也可能没有存储T类型的值,只有当optional ...