Script for automatic assignment of peaks using a database

1 visualizzazione (ultimi 30 giorni)
I am working on LIBS for identification of elemental composition. I am doing this by comparing my experimental data with a LIBS database. However, I have been doing this by plotting each of the element in the database with my experimental data. I need help on writing a script that can automatically assign peaks based on the comparison for all element at once to save time. Can anyone guide me on writing the script please?
Hint: LIBS database consist of individual spectrum of Intensity vs wavelength for many elements based on choice while experiment data is just a single spectra of intensity vs wavelength.

Risposte (1)

Shivansh
Shivansh il 29 Ago 2023
Hi Doyinsola,
I have provided the basic outline of the script which can be used to gain the above results. I have assumed that you have the datasets in a format accepted by MATLAB such as ‘.csv’ or ‘.xlsx’.
  1. Load the experimental data: You can do this by using the ‘load’ function.
  2. Load the LIBS dataset: You can load the LIBS database into MATLAB using the load command depending upon the format of file.
  3. Preprocess the datasets: Preprocess the datasets to make any necessary changes if required to remove noise or perform adjustments.
  4. Iterating through database: Iterate through the LIBS database for each element to find the peak positions for the required features and compare it with the corresponding experimental data. You can store them in a new column or as a new variable. You can use functions like ‘max’, ‘findpeaks’ for finding the peaks.
for i = 1:num_elements
Max_Val= max(DataSet(i,Col_Num));
Col_to_compare(i) = Max_Val;
end
num_elemnts: Total number of elemnts.
Col_Num = Column number of interest.
Col_to_compare = Column storing values for comparison purposes.
5. You can analyse and visualise the results now by generating plots or performing statistical calculations.
Links to the documentations for the functions
  1. load: Load variables from file into workspace - MATLAB load - MathWorks India
  2. max: Maximum elements of array - MATLAB max - MathWorks India
  3. findpeaks: Find local maxima - MATLAB findpeaks - MathWorks India
  4. plot: 2-D line plot - MATLAB plot - MathWorks India

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by