How to correct cumtrapz integration constant
3 views (last 30 days)
Show older comments
Hello everyone,
I'm trying to find the spectrum of EPR data (eletron paramagnetic resonance) and to do so I have to integrate the data.
The problem is that, when integrating the curb from the left, I would expect to have a peak with two flat border on 0. Whereas, as you can see in the right part of the image, there is a sort of step.
I think this step is due to an integration constant problem, but I couldn't find anywhere a method to correct it. The only way I though is to do minus 4.9 for the right part of the graph, but I'm afraid it would wrong the integration, and that would be bad (because I need to integrate again the spectrum to find the area under the peak of the spectrum).
Could you please help me? Thank you so much for reading it already!
PS: The part of the code where I integrate and plot these images. intensity_c corresponds to the original data with their baseline corrected (so it is all flat and alined in 0, like in the left graph of the image)
figure
plot(field,intensity_c)
grid on
xlabel('field')
ylabel('intensity')
title('Derivated Spectrum')
int_intensity = cumtrapz(field, intensity_c);
figure
plot(field,int_intensity)
xlabel('field')
ylabel('intensity')
grid on
title('Spectrum')
4 Comments
Bjorn Gustavsson
on 29 Mar 2022
If that is the function of the derivative you can take Torsten's idea in a slightly different direction by fliping the array around the symmetry-point and plot the negative of that just to visually compare the positive and negative peaks to possibly see how "not symmetric" it is.
Answers (1)
Elise C
on 29 Mar 2022
1 Comment
Bjorn Gustavsson
on 29 Mar 2022
Good that you solved your problem.
Just 5 mnutes ago I had to explain that in most situations when I have problems I feel a bit stupid, but when I finally solve them I feel some small tingle of achievment, but in computing and computing only I feel stupider and stupider the longer we look for our errors, and then when I solve them I feel really stupid (because the problem was too obvious and the solution to simple). Now I've gotten used to this sequence of events, and my forehead has become strong.
See Also
Categories
Find more on Time Series Events in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!