cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Factorization the spectrum of signals

sal-fartosy
1-Newbie

Factorization the spectrum of signals

Hello everybody,

Please I need someone to help me about who can I do a factorization to the spectrum of three signals in Mathcad 14. I mean for each spectrum and then I want to do the factorization for all signals.

Thanks in advance for any help.

Best Regards,

1 ACCEPTED SOLUTION

Accepted Solutions
StuartBruff
23-Emerald II
(To:RichardJ)

Richard Jackson wrote:

I cheerfully confess that I'd never even heard of the word factorization in connection with spectra until this thread arose.

I have, and in fact I do it all the time. Think of a spectrum with N points as a vector that represents a point in N dimensional space. If you have several spectra, then they form a group of points in that space. Each of the N axes represents the intensity or amplitude at a given frequency. To solve any given problem, however, those may not be the optimal choice of axes. We can generate a new set of axes by creating a new set of "spectra", or factors, that are linear combinations of the current spectra, which corresponds to rotating our original axes. The simplest scheme is to make the new axes point in the directions of maximum variance in the data, which is principal component analysis. It's useful because if the number of underlying sources of variation in the data is less than N (often the case in spectra) then after rotation all the values on some axes are zero, or very close to zero, and we can throw them away. in other words, we can reduce the dimensionality of the data with minimal, and controllable, loss of information. If you look in the DAEP under "Principal Component Analysis" and "Principal Component Regression of NIR Spectra for Alcohol Mixtures" there are a couple of examples. There are lots of other factoring schemes though, that use different criteria for the axes rotation, including some that don't even guarantee that the new axes are orthogonal (which PCA does). Which is best depends on what the end goal is (for example, in the analysis of the alcohol mixtures, PCA is actually not optimal. A better method is partial least squares, which takes into account the known concentrations. That would be another (long) worksheet though, and I've never bothered to to write it in Mathcad).

I don't know if that's what Sabah actually wants to do though. Especially given that there are only three spectra, in which case I can't see much benefit to factoring as I understand it.

Thanks, Richard.  A very good explanation - got it!   I'll re-read the DAEP.

Cheers,

Stuart

View solution in original post

8 REPLIES 8
RichardJ
19-Tanzanite
(To:sal-fartosy)

Could you be more specific about what you want to do. Do you mean you want to do a principle component analysis of the spectra?

StuartBruff
23-Emerald II
(To:RichardJ)

Richard Jackson wrote:

Could you be more specific about what you want to do. Do you mean you want to do a principle component analysis of the spectra?

Hi Richard,

I cheerfully confess that I'd never even heard of the word factorization in connection with spectra until this thread arose.  However, a quick, but not particularly fruitful (*), webcrawl suggests that it may occur in the context of spectrograms.  In which case, the underlying Mathcad technique would seem to be reshaping the signal vectors to form an array of contiguous subsignals and then apply an FFT to each of these subsignals?  Is that the general idea?  If so, do you think the attached worksheet might be of some interest (it was a bit of a pain writing for a non-zero ORIGIN!)? ...

Stuart

(*) Most of the sites I looked at tended to assume you knew what factorization was in the first place!

RichardJ
19-Tanzanite
(To:StuartBruff)

I cheerfully confess that I'd never even heard of the word factorization in connection with spectra until this thread arose.

I have, and in fact I do it all the time. Think of a spectrum with N points as a vector that represents a point in N dimensional space. If you have several spectra, then they form a group of points in that space. Each of the N axes represents the intensity or amplitude at a given frequency. To solve any given problem, however, those may not be the optimal choice of axes. We can generate a new set of axes by creating a new set of "spectra", or factors, that are linear combinations of the current spectra, which corresponds to rotating our original axes. The simplest scheme is to make the new axes point in the directions of maximum variance in the data, which is principal component analysis. It's useful because if the number of underlying sources of variation in the data is less than N (often the case in spectra) then after rotation all the values on some axes are zero, or very close to zero, and we can throw them away. in other words, we can reduce the dimensionality of the data with minimal, and controllable, loss of information. If you look in the DAEP under "Principal Component Analysis" and "Principal Component Regression of NIR Spectra for Alcohol Mixtures" there are a couple of examples. There are lots of other factoring schemes though, that use different criteria for the axes rotation, including some that don't even guarantee that the new axes are orthogonal (which PCA does). Which is best depends on what the end goal is (for example, in the analysis of the alcohol mixtures, PCA is actually not optimal. A better method is partial least squares, which takes into account the known concentrations. That would be another (long) worksheet though, and I've never bothered to to write it in Mathcad).

I don't know if that's what Sabah actually wants to do though. Especially given that there are only three spectra, in which case I can't see much benefit to factoring as I understand it.

StuartBruff
23-Emerald II
(To:RichardJ)

Richard Jackson wrote:

I cheerfully confess that I'd never even heard of the word factorization in connection with spectra until this thread arose.

I have, and in fact I do it all the time. Think of a spectrum with N points as a vector that represents a point in N dimensional space. If you have several spectra, then they form a group of points in that space. Each of the N axes represents the intensity or amplitude at a given frequency. To solve any given problem, however, those may not be the optimal choice of axes. We can generate a new set of axes by creating a new set of "spectra", or factors, that are linear combinations of the current spectra, which corresponds to rotating our original axes. The simplest scheme is to make the new axes point in the directions of maximum variance in the data, which is principal component analysis. It's useful because if the number of underlying sources of variation in the data is less than N (often the case in spectra) then after rotation all the values on some axes are zero, or very close to zero, and we can throw them away. in other words, we can reduce the dimensionality of the data with minimal, and controllable, loss of information. If you look in the DAEP under "Principal Component Analysis" and "Principal Component Regression of NIR Spectra for Alcohol Mixtures" there are a couple of examples. There are lots of other factoring schemes though, that use different criteria for the axes rotation, including some that don't even guarantee that the new axes are orthogonal (which PCA does). Which is best depends on what the end goal is (for example, in the analysis of the alcohol mixtures, PCA is actually not optimal. A better method is partial least squares, which takes into account the known concentrations. That would be another (long) worksheet though, and I've never bothered to to write it in Mathcad).

I don't know if that's what Sabah actually wants to do though. Especially given that there are only three spectra, in which case I can't see much benefit to factoring as I understand it.

Thanks, Richard.  A very good explanation - got it!   I'll re-read the DAEP.

Cheers,

Stuart

Thank you guys I got what I want. I am really so happy to got your help.

Best Regards,

sabah al-fartosy wrote:

Thank you guys I got what I want. I am really so happy to got your help.

No problem .... umm, just out of interest, what was it exactly that you wanted, ie what do you mean by factorization?  It will help us better tailor our responses to any future questions along the same lines.  Thanks.

Stuart

Hello my friends,

I am actually so appreciated for your great works. I meant form factorization is to figure our the effects of the repeatability when I tested concrete specimens to get their spectra for around three times for each. Honestly, I am not professional with Mathcad, but you help me to get closer for what I need in my question.

Thanks again guys and I will so happy to see your posts for the future concerns with Mathcad.

Best Regards,

Sabah

sabah al-fartosy wrote:

.... Honestly, I am not professional with Mathcad ...

You're not the only one.  I didn't check that my modified vec,seq, index, vec2mat and reshape functions worked for all values of ORIGIN.    (I normally use ORIGIN=0 and write my functions accordingly; however, your worksheet seemed like a good excuse to modify them for any ORIGIN ... ).

I *think* the revised sheets contains corrected versions of these functions.

Stuart

Top Tags