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 个评论
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
2022-3-29
1 个评论
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 Center 和 File Exchange 中查找有关 Time Series Events 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!