Archive | Matlab RSS feed for this section

3 January 2010 1 Comment

Finding Local Extrema / Peaks From a Noisy Data

Finding Local Extrema / Peaks From a Noisy Data

I’m trying to locate and measure the positive peaks in a noisy data sets. I compared some command and popular method and found the findpeak method produced the best result.

Tags: , ,
2 January 2010 0 Comments

Matlab Tips in Signal Processing

Moving average filter To compute an N-sample moving average of x with zero padding: For large N, it is faster to use Locating zero-crossings and extrema To obtain the indices where signal x crosses zero: Linear interpolation can be used for subsample estimates of zero-crossing locations: Since local maximum and minimum points of a signal [...]

Tags: ,
1 January 2010 0 Comments

How to Install Python as a Replacement to Matlab

Python has matured to the point where it is a very powerful computational environment with flexibility that is unmatched by any commercial product. But this flexibility comes at the cost of a very fragmented install procedure. The default installation of python is feature poor and the needed features for computations are spread out over many [...]

1 January 2010 0 Comments

How Long are Movies?

How Long are Movies?

Background: Going to the movies requires the larger part of an evening and it is not uncommon to rent movies spanning two DVDs. Fueled by this observation I explore data published by the Internet Movie Database to test the hypothesis that movies are getting longer. Leading to the conclusion that movies have had a constant [...]

1 January 2010 0 Comments

Basic Sound Processing with MATLAB

Basic Sound Processing with MATLAB

This page describes some basic sound processing functions in MATLAB. We’ll begin by reading in a wav file. You can download it here 440_sine.wav it contains a complex tone with a 440 Hz fundamental frequency (F0) plus noise.

31 December 2009 0 Comments

Matlab Quick Reference: Plot

Matlab Quick Reference: Plot

Matlab figure title with two lines   12345678910clc plot(1:10) title({‘Comparison of Results’;'using Mean Squared Error (MSE)’}) set(gca, ‘Units’, ‘Normalized’) P=get(gca,’Position’); % Shrink the bottom margin by half its height and % enlarge the top margin by the same amount % (since the axis is the same height before & after) set(gca, ‘Position’, [P(1) P(2)/2 P(3) [...]

31 December 2009 0 Comments

Matlab Quick Reference: Input/Ouput

I/O Extract date from file 12s = dir(‘junk.m’);     s.date Open a formatted text file 1fid = fopen(‘file.dat’,'w’) w: write r: read a: append returns -1 if error If the file is a text file and you want to write to it, consider using ‘t’ as an attribute if you want Windows line break [...]

31 December 2009 0 Comments

Matlab Quick Reference: Functions

Functions Syntax 12345function y = average(x) % AVERAGE Mean of vector elements. % only first comment line is printed when you type “lookfor average” % the other lines print when you type “help average” y = sum(x)/length(x); % Actual computation 1function [Xout,Yout] = myFunc(x) Number Of Arguments nargin: number of input arguments nargout: number of [...]

31 December 2009 0 Comments

Matlab Quick Reference: General

My Matlab quick reference: General notes

30 December 2009 0 Comments

Faster Matlab Calculation: Use Preallocation

Preallocation I am a believer in preallocation.  For a particular application, I read in about 13GB of data from a file into a 4-D matrix (this was running on a machine with 32GB of memory).  Before preallocation, I let the process run for about 10 hours, and it still hadn’t finished.  With preallocation the process [...]