How to correct cumtrapz integration constant

4 次查看(过去 30 天)
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 个评论
Elise C
Elise C 2022-3-29
Thank you for your comments!
Honnestly I don't know what to do since I'm not supposed to modify the data. I will look more in detail in the litterature.
Bjorn Gustavsson
Bjorn Gustavsson 2022-3-29
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.

请先登录,再进行评论。

回答(1 个)

Elise C
Elise C 2022-3-29
Hello,
Your comments helped me find the solution!
As you all thought in the comments, the error was due to the fact that the second peak area was smaller than the first. Thus when integrating, it wasn't compentiated. But when I actually made my measure, the area used to be the same before correction of the baseline!
So my I realised my mistake is: I corrected the baseline too soon! If I correct the baseline AFTER integrating, then it works perfectly (see image, made with other data than the one of the previous figure:)
I should have realised it sooner, I'm a bit ashamed. But I leave the post here: it may help someone!
Anyway, thank you!
  1 个评论
Bjorn Gustavsson
Bjorn Gustavsson 2022-3-29
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Time Series Events 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by