Plotting spectra...(rescaling x axis)

Asked by Tamas about 13 hours ago
Latest activity Answered by dpb about 9 hours ago

Hi there,

I would greatly appreciate any help for this simple enough issue:

I have a spectra to plot (2D), with 1201 rows (x), and 74 columns (y). My x is a range of 200nm- 800nm. This is what I would like to display on the x axis proportionally. Although Matlab plot function automatically display my sample number which is 1201 (0- 1201 etc). How could I re-scale my x axis without losing any information and displaying my x from 200nm to 800nm.

Hope this is clear enough explanation...

Again, greatly appreciate any help...

Thank you in advance.

0 Comments

Tamas

Tags

Products

No products are associated with this question.

1 Answer

Answer by dpb about 9 hours ago
Edited by dpb about 4 hours ago

Simplest is to simply build the x vector and use it to plot() against instead of the default index vector.

If it is indeed linear from 200:800 for 1201 points, then linspace is your friend...

x=linspace(200,800,length(y))';  % Use length(y) for dynamic matching...
plot(x,y)

NB the "'" transpose on x to create a column vector to make the shape commensurate w/ the y array since linspace returns a row vector.

0 Comments

dpb

Contact us