I'm currently plotting an array with 550K elements which belong to a spectroscopic spectrum in MATLAB and encountering some issues. The plot itself ranges from 2040-2150 cm^-1, but if I want to isolate a peak in said spectrum around 2060 cm^-1, how would I do that without performing too many steps and just fill in the x-value of the peak center and possibly the range around it?
I've been looking around the forums but none of those mention anything regarding huge data arrays, only smaller arrays where they refer to xlim.
If you have some data spanning the x range 2040 to 2150:
x = linspace( 2040, 2150, 1e4 );
y = rand( size( x ) );
And you want to plot just the data between 2050 and 2070, i.e. 2060 +/- 10, you could just create an indexing array of the values you're interested in
xmid = 2060;
xwidth = 10;
idx = abs(x - xmid) <= xwidth;
Then plot using that subset
plot( x(idx), y(idx) );