resample

From DavinciWiki
Jump to: navigation, search


Description

Resample a spectrum to a given scale using a cubic spline interpolator

Arguments and Return Values

Arguments: A numeric array and two scales

Return Value: A numeric array

Usage

Syntax: resample(spectra, old scale, new scale) or resample(spectral_structure, new scale)

'spectra' - Spectra to be resampled

'old scale' - The scale of the old spectra

'new scale' - The desired scale of the spectra

'spectral_structure' - The structure containing .data, .label or .sample_name, and .xaxis

resample() does a spline interpolation between points to fill in the data

Examples

dv> a
10x1x1 array of float, bsq format [40 bytes]
0.0268005 2.73336 2.09211 2.52448 2.75938 2.74045 9.32405 0.195576 5.41650 3.36574

dv> old_scale = a
10x1x1 array of int, bsq format [40 bytes]
1       2       3       4       5       6       7       8       9       10

dv> new_scale = create(100,1,1,start=1,step=.1,format=float)
100x1x1 array of float, bsq format [400 bytes]
1.00000 1.10000 1.20000 1.30000 1.40000 1.50000 1.60000 1.70000 1.80000 1.90000 
2.00000 2.10000 2.200002.30000  2.40000 2.50000 2.60000 2.70000 2.80000 2.90000
3.00000 3.10000 3.20000 3.30000 3.40000 3.50000 3.60000 3.70000 3.80000 3.90000
4.00000 4.10000 4.20000 4.30000 4.40000 4.50000 4.60000 4.70000 4.80000 4.90000
5.00000 5.10000 5.20000 5.30000 5.40000 5.50000 5.60000 5.70000 5.80000 5.90000
6.00000 6.10000 6.20000 6.30000 6.40000 6.50000 6.60000 6.70000 6.80000 6.90000
7.00000 7.10000 7.20000 7.30000 7.40000 7.50000 7.60000 7.70000 7.80000 7.90000
8.00000 8.10000 8.20000 8.30000 8.40000 8.50000 8.60000 8.70000 8.80000 8.90000
9.00000 9.10000 9.20000 9.30000 9.40000 9.50000 9.60000 9.70000 9.80000 9.90000
10.0000 10.1000 10.2000 10.3000 10.4000 10.5000 10.6000 10.7000 10.8000 10.9000

dv> b=resample(a,old_scale,new_scale)
struct, 3 elements
    data: 1x1x100 array of float, bsq format [400 bytes]
    label: 0
    xaxis: 1x1x100 array of float, bsq format [400 bytes]

Images

resample1.png resample2.png

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Related Functions

Recent Core Changes

Modified On: 03-30-2009

Personal tools