mAtlab
TIPs and
TRicks and
...Page Overview:
I created this page as a vectorization helper and it grew to become my annotated Matlab reading cache. In order to motivate the DSP people out there, I am showing below what one can apply a window and scale factors on a pre-fr Amed signal using no loops and minimal memory.
%For framing use buffer () or your own favorite% Frame Length: the, Number of frames:10000X= Randn ( the,10000);% make a window (same forEach frame) W= Hamming ( the); W=diag (Sparse (w));% this isthe windowed signal, without LOOPSXW= 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 factorxg= X *G;% windowing and gain scaling isJust left and right product with a diagonal. XWG= W * X * G;
Local Links:
Note that some of the following documents is taken off of the 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 on the 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 is working with multi-linear forms you'll definitely appreciate this.
- GUI with MATLAB, 2005-06-15
A presentation on the 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 so you'll ever start writing with such style but here's a bunch of suggestions. Well on page 9 it reads "Avoid Cryptic Code", the 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, and you might find what is 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. Does I really need to reallocate memory for output?
- Why does I receive a segmentation violation mentioning the Toolbox cache when starting MATLAB? , 2004-03-03
Well I got to love this line: "Some customers has found that updating the driver for your video card can resolve th e problem as well. " Remember that we is 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 is 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 does I receive errors when overloading Subsref for types {} and. For MATLAB OOPS Objects (31436) (pdf), 2003-06-11
If you had ever tried to write your own classes in Matlab chances is you run into the problems described in this article .
- Simplify your code with comma-separated lists (pdf), 2003-06-08
Very valuable cases is presented. The first is the Fftshift () function which are all your need to know on the most flexible indexing method in Matlab. When you really understand Fftshift () take a look at Flipdim () and you is 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 both main uses of deal are explained:
[c{:}] = Deal (s.name); % the only-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 was a very easy reading.
- Think globally, Act locally (pdf), 2003-06-08
A nice pattern for variable number number of the input arguments is mentioned.
function Heatmodel (varargin)
Defaultvalues = {100,72,350};
Nonemptyidx = ~cellfun (慽 sempty?,varargin); Technorati Tags:
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 comple X arithmetic. Had MathWorks done the those cryptic "X" Messages in profiler life would is easier ...
- Is it possible-run MATLAB in the background under UNIX? (+) (pdf), 2003-06-04
Guess what? It is!
- Techniques for debugging MATLAB M-files (1207) (pdf), m-files (Zip), 2003-05-13
If you're a newbie and you ' re have problems with basic errors download the above m-files. Chances is your error was identified and solved in one of the examples.
- What's 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 to disable quote ' s special functionality. In other languages one would expect to escape the quote by \ "but not in Matlab. What are really need to know are 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 hers code in a DLL and has it called from Matlab. Pointers to any type of Matlab variables can is defined straight in the workspace and can is passed to C + +. Call by reference are now possible.
- Printing and Exporting Guide (1206) (PDF) 2003-02-27
- Exporting figures for Publication B (pdf), m-files (Zip) 2003-02-27
Use the 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 has never been that fast!
- Fast manipulation of multi-dimensional arrays in Matlab (PDF)
(older version here)
- How does 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)
Article reproduced from Marios Athineos matlab tips and tricks and ....
Matlab Tips and Tricks