Double integration of principal componant
Show older comments
Hi,
I'm work in FTIR signal processing.
I would like to make double integration of principal components (PC) calculated on 2nd derivative of spectra to obtain something looking like spectra.
I use cumtrapz function but there is some problems...
When I use cumtrapz one time on PC based on first derivative spectra, the result seems to be ok. But when I use cumtrapz two time on PC based on second derivative, result are like if cumtrapz add a ax+b function (different depending on th PC) to the result I want. So the resulting "spectra" present a strong deviation(once again, different for each PCs)...
"Trapz" function doesn't works at all...
How to solve this problem? I'm nearly desperate...I hope someone could help me.
Best regards,
TRAVO Adrian
PS: I'm a MATLAB noob, and as a biologist, mathematics is a nightmare for me.
PS2: sorry for my poor english skill, hope my message is understandable.
Answers (2)
Walter Roberson
on 30 Mar 2011
0 votes
This is not surprising. cumtrapz is approximating an integral. int(f''(x)) = f'(x) + c1 where c1 is an arbitrary constant. int(int(f''(x)) = int(f'(x)+c1) = f(x) + c1*x + c2 where c1 and c2 are arbitrary constants. If you take f(x) + c1*x + c2 for any arbitrary finite constants c1 and c2 and take the second derivative, then you will get f''(x). This means that if your first cumtrapz() turns out to be off by a constant, then when you do the second cumtrapz() the result can be off by a linear amount a*x+b .
Adrian TRAVO
on 30 Mar 2011
0 votes
Categories
Find more on Numerical Integration and Differentiation 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!