No BSD License  

Highlights from
multiresolution_subtract.m

3.0

3.0 | 1 rating Rate this file 3 Downloads (last 30 days) File Size: 1.56 KB File ID: #6525

multiresolution_subtract.m

by Daniel Feldman

 

10 Dec 2004 (Updated 15 Dec 2004)

Subtracts vectors @ different resolution.

| Watch this File

File Information
Description

This function will subtract two vectors x and y at different resolutions x_grid and y_grid and give an output at the lower resolution. Either x or y may be the low-resolution vector. Vectors may be unsorted according to x_grid and y_grid, but they will be sorted using sort_by_x.m.

Function operates very fast with decent accuracy, but has option to operate slowly at increased accuracy.

MATLAB release MATLAB 6.5.1 (R13SP1)
Other requirements None
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
15 Oct 2009 Jan Simon

z = multiresolution_subtract(x, x_grid, y, y_grid)
is equivalent to the Matlab method:
z = interp1(x_grid, x, y_grid, 'nearest') - y;
For x = [1x600] and y = [1x110], the INTERP1 method takes 14% of multiresolution_subtract (in fast mode). Therefore this function is not "very fast". And there are even faster methods for interpolation than INTERP1.
The helper function sort_by_x is really slow compared to Matlab's SORT (see comments for your FEX: 6424).
If x and y are smooth, a linear interpolation can be more useful: z = interp1(x_grid, x, y_grid, 'linear') - y;
It works, has a help text, H1-line not useful, author and date are mentioned.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
subtract Daniel Feldman 22 Oct 2008 07:37:52
vectors Daniel Feldman 22 Oct 2008 07:37:52
different Daniel Feldman 22 Oct 2008 07:37:52
resolution Daniel Feldman 22 Oct 2008 07:37:52
utilities Daniel Feldman 22 Oct 2008 07:37:52

Contact us at files@mathworks.com