Is there a signal processing module for PDL? - perl

Is there a module for the Perl Data Language that is similar to the Matlab signal processing toolbox? I'm aware of PDL::FFT(W), but can't find any functions for filter construction or estimation of statistical properties.

Alas, no. While it is likely that you can accomplish the same ends as Matlab's signal processing toolbox with your own combination of convolutions, cross products, etc, nobody has written a comprehensive signal processing toolkit with PDL. PDL started as a competitor to IDL, so its strongest bindings focus on image manipulation.
If you are considering making your own toolbox (which would be FANTASTIC!), I would suggest PDL::TimeSeries.

There is now at least https://metacpan.org/pod/PDL::DSP::Fir for finite impulse response filter kernels.

PDL::Audio has filters (including FIR filters, aka convolution). I'm sure it's nowhere near as full-featured as the Matlab toolbox, and it has lots of stuff you're probably not interested in (it's designed for making sound, after all), but it will do at least some of what you want.
If I were making this module, I'd call it PDL::DSP.

Related

Why is SIFT not available in Matlab?

SIFT is an important and useful algorithm in computer vision but it seems that it is not part of Matlab or any of its toolboxes.
Why ? Does Matlab offer something better or equivalent ?
MATLAB has SURF available as part of the Computer Vision Toolbox but not SIFT: http://www.mathworks.com/help/vision/ref/surfpoints-class.html. However, both algorithms are pretty much the same with some minor (but crucial) differences, such as using integral images and a fast Hessian detector. I won't go into those differences in any further detail, but you can certainly read up on the work here: http://www.vision.ee.ethz.ch/~surf/eccv06.pdf. As to the reason why MathWorks decided to use SURF instead of SIFT... it could be any reason really. AFAIK, there is no official reason why one was chosen over the other as they are both subject to being patented.
However, if you want to use SIFT within MATLAB, one suggestion I have is to use the VLFeat toolbox where a C and MATLAB implementation of the keypoint, detection and matching framework has been made available and is open source. It also has a variety of other nice computer vision algorithms implemented, but VLFeat is one of the libraries that I know of that manages to compute SIFT as accurately as the original patented algorithm.
If you're dead set on using SIFT, check VLFeat out! Specifically, check out the official VLFeat tutorial on SIFT using the MATLAB wrappers: http://www.vlfeat.org/overview/sift.html

Plotting graph with respect to frequency

I am doing a project on Open Modelica and i have to simulate filters on it using active elements(op amp). Modelica plots graph with respect to time but i want my graphs with respect to frequency to analyze the frequency response of the system. I searched the internet but couldn't find anything useful. Please reply as soon as possible.
If you want to plot a variable with respect to another variable you can use plotParameteric from OMShell (OpenModelica Shell). In OMEdit (OpenModelica Connection Editor) you can click on parametric plot button x(y) and then select 2 variables.
I assume that what you want is a Bode plot. If so, it is important to understand that such a plot does not arise from a transient simulation. It is necessary to transform your system into a linear, time-invariant representation in order to express the response of your system in the frequency domain.
I do not know what specific features OpenModelica has in this regard. But those are at least the kinds of things you should search the documentation for. If you have access to MATLAB, then all you really need to do is extract the linearized version of the model (normally expressed as the so-called "ABCD" matrices) and MATLAB can get you the rest of the way.
There is also the Modelica_LinearSystems2 library which might be compatible with OpenModelica (I have no idea). It includes many types of operations you would typically perform on linear systems.

Can Matlab use multiple processors for plots and interactions in plots?

I am analyzing EMG data in my research lab. One of the steps is to calculate a continuous wavelet transformation of the dataset (size ~80000). Therefore, I use Matlab with the wavelet toolbox and "cwt" to plot a 3D-scalogram.
The calculation takes a lot of time and any interaction like 3D-rotation (which is very important to see different aspects of the data) is nearly impossible.
The resource-monitor shows that only one of my hexa-core processor is working. I use parallel computing for other calculations and haven't found any solution or even a similiar question like this.
Is there anything I can do to activate multicore support for plots?
I'll hazard an educated guess and plump for the answer No to your question Is there anything I can do to activate multicore support for plots?
Matlab can certainly use multiple cores for its computations. Many of its intrinsic functions are already multi-threaded and will use any available cores without the programmer (or user) having to do take any special measures. For your own computations you can use the Parallel Compute Toolbox.
However, unless you have some very special graphics hardware (and if you do why didn't you mention it ?) your display shows you why only one processor is being used when you interact with your 3D plots -- somewhere between the screen and the hardware of your computer there is a bottleneck through which the outputs of all those cores are squeezed into one stream of bits and bytes for presentation.
Your experience is consistent with that bottleneck being the Matlab visualisation routines, I think it is safe to conclude from the evidence you present, that the Mathworks haven't multi-threaded the routines which compute the new screen positions of each element in a plot as you rotate it, or any of the other processing that goes on to turn the results of your analyses into a picture or pictures. If they did parallelise those routines, that would shift the bottleneck but not remove it.
To remove the bottleneck you would have to have a way for different Matlab threads to separately address different parts of your screen; I see no evidence that Matlab has that capability. Google will find you a ton of references to parallel rendering but I see no sign that Matlab currently implements any aspect of this.
I'll just add, in response to your comment where you write unfortunately I can't resample my data that you should be mindful that Matlab's visualisation routines are resampling your data for presentation unless you are only visualising datasets with numbers of samples less than the number of pixels available. If you visualise a time series with 80000 samples on a display with 2000 pixels horizontally, something has got to give.
You might get better graphics performance and superior understanding if you take charge of that resampling yourself.
Matlab plotting performance is pretty bad, it's more focused on customizability than performance. Using MEX to run some native C++ code to plot the data with OpenGL will likely be much much faster.

Wavelet Transform - Matlab

I would like to learn how does the Wavelet transform works from a practical point of view. I have read the theory regarding it and I think that I have understood the main idea behind it, but I would like to have some practice with it.
Can you please recommend me some tutorial and some data which I can use for learning the Wavelet Transform by using Matlab environment?
I tried to search for audio signal or practical tutorial on which I can work on but I had no results.
The Mathworks site has some information on their wavelet toolbox and some simple examples of continuous 1D wavelet transforms and discrete 2D wavelet transforms.
Since you have studied and understood the theory behind wavelet transforms, the best way to learn is to go through the source code for various algorithms that have been used by others. For starters looking at the core of the various functions provided in the toolbox above (just enter type functionname at the command line in MATLAB. Unless if it's a built-in function, you'll see the file contents). By core of the function, I mean the main algorithm without all the various input checks that are common.
The Wavelab toolbox from Stanford university is also a good resource to learn from (and later use in your applications when you're comfortable with it).
Lastly, this is a resource I found by Googling and it looks like they have some examples that you can try out.

Feature Selection methods in MATLAB?

I am trying to do some text classification with SVMs in MATLAB and really would to know if MATLAB has any methods for feature selection(Chi Sq.,MI,....), For the reason that I wan to try various methods and keeping the best method, I don't have time to implement all of them. That's why I am looking for such methods in MATLAB.Does any one know?
svmtrain
MATLAB has other utilities for classification like cluster analysis, random forests, etc.
If you don't have the required toolbox for svmtrain, I recommend LIBSVM. It's free and I've used it a lot with good results.
The Statistics Toolbox has sequentialfs. See also the documentation on feature selection.
A similar approach is dimensionality reduction. In MATLAB you can easily perform PCA or Factor analysis.
Alternatively you can take a wrapper approach to feature selection. You would search through the space of features by taking a subset of features each time, and evaluating that subset using any classification algorithm you decide (LDA, Decision tree, SVM, ..). You can do this as an exhaustively or using some kind of heuristic to guide the search (greedy, GA, SA, ..)
If you have access to the Bioinformatics Toolbox, it has a randfeatures function that does a similar thing. There's even a couple of cool demos of actual use cases.
May be this might help:
There are two ways of selecting the features in the classification:
Using fselect.py from libsvm tool directory (http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/#feature_selection_tool)
Using sequentialfs from statistics toolbox.
I would recommend using fselect.py as it provides more options - like automatic grid search for optimum parameters (using grid.py). It also provides an F-score based on the discrimination ability of the features (see http://www.csie.ntu.edu.tw/~cjlin/papers/features.pdf for details of F-score).
Since fselect.py is written in python, either you can use python interface or as I prefer, use matlab to perform a system call to python:
system('python fselect.py <training file name>')
Its important that you have python installed, libsvm compiled (and you are in the tools directory of libsvm which has grid.py and other files).
It is necessary to have the training file in libsvm format (sparse format). You can do that by using sparse function in matlab and then libsvmwrite.
xtrain_sparse = sparse(xtrain)
libsvmwrite('filename.txt',ytrain,xtrain_sparse)
Hope this helps.
For sequentialfs with libsvm, you can see this post:
Features selection with sequentialfs with libsvm