10-26-2017 04:00 PM
I have two data files attached. Both files are spectroscopic scans and contain several gaussian-shaped peaks. The first file is the experimentally file, it contains 181 x,y points. The second file is a simulated file that contains 1191 x,y points. The goal is to perform and least-squares fit against a library of simulated files of the exact same size. However, I have two problems. The first problem is that the experimental spectrum is shifted relative to the simulated spectrum. The second problem is that in order to perform a proper least square fit analysis the number of points in the two files need to match. I have accounted for the spectral shift by adding a "wavelength correction." However I am unable to properly re-grid the experimental data in order to have the same number of points as the simulation. I have tried the NI_GMath_1D Interpolation.vi but the total number points after interpolation is only done in whole numbers of the original number of points (181). I have played around with the spline interpolation, but I haven't had much success either. Any advice would be much appreciated. Thank you.
Solved! Go to Solution.
10-26-2017 04:29 PM
Your experimental text file has the same number in the x-axis. Need more sig figs.
10-26-2017 04:41 PM
As mentioned the data files have poor data formating.
After you fix that the vi you want is "Resample Waveforms.vi (single shot)" and "Align Waveforms.vi (single shot)"
Caution, don't use the Express.vi here. I'm finding some strange constructs under the hood that will be OT for you
10-26-2017 05:06 PM
My mistake, here is a text file of the experimental data points with more sig figs.
10-26-2017 06:03 PM
You can do this with 2D DBL arrays using the Interpolate 1D.vi. You may need to truncate the arrays to so that the ranges of the simulated and experimental arrays match. You absolutely need to scale the X values for one of the datasets so that it matches the range of the other. Looks like you are comparing Angstroms to nm.
10-26-2017 06:11 PM - edited 10-26-2017 06:14 PM
@gabe2327 wrote:
You can do this with 2D DBL arrays using the Interpolate 1D.vi. You may need to truncate the arrays to so that the ranges of the simulated and experimental arrays match. You absolutely need to scale the X values for one of the datasets so that it matches the range of the other. Looks like you are comparing Angstroms to nm.
Possible, but my 8-Ball says it Spectral Power (Freq vs Amplitude in dBm)
And yes, after the signals have been resampled and aligned...the interpolation is childs play
10-26-2017 06:49 PM
I have been looking at and playing with your vi and it looks like you are almost there. The one thing I noticed is that you have at least one experimental data point at the origin (0,0) which is screwing up your upper plot. You probably need to check your data and see what is actually being put into your graphs before you plot them. You can also zoom in on your real data using the Graph Palette.