Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Fit spectrum with weighted Gaussians

Subject: Fit spectrum with weighted Gaussians

From: Lara McManus

Date: 31 Oct, 2010 22:47:03

Message: 1 of 4

I want to fit a spectrum of light using Gaussians functions to represent various components of light (blue, red etc.), but I also want this fit to include a white light source, which consists of 3 gaussians and these need to retain the same relative intensities. I have been able to uses the curvefit toolbox on Matlab to fit it with single uncorrelated gaussians, but I would like to now include the white light (with the 3 weighted Gaussians) in the analysis and was wondering if anyone has any ideas on how to do this.

Any help or advice would be greatly appreciated!

Subject: Fit spectrum with weighted Gaussians

From: Miroslav Balda

Date: 1 Nov, 2010 15:24:04

Message: 2 of 4

"Lara McManus" <lara_m@live.ie> wrote in message <iakrl7$2pi$1@fred.mathworks.com>...
> I want to fit a spectrum of light using Gaussians functions to represent various components of light (blue, red etc.), but I also want this fit to include a white light source, which consists of 3 gaussians and these need to retain the same relative intensities. I have been able to uses the curvefit toolbox on Matlab to fit it with single uncorrelated gaussians, but I would like to now include the white light (with the 3 weighted Gaussians) in the analysis and was wondering if anyone has any ideas on how to do this.
>
> Any help or advice would be greatly appreciated!

Hi Lara,

I think it is a problem of linear regression.
Say that you have 3 spectra:
   Sxx(f), a required spectrum,
   Sww(f), your spectrum of white light, and
   Scc(f), spectrum of the chosen color (a Gaussian function).

The required spectrum is then
   Sxx(f) = a*Scc(f) = b*Sww(f).
It is clear that all spectra should be defined on the same frequency interval. However, if the Scc(f) is not one of the colours contained in Sww(f), the fit might be rather bad. It would occur if the choice of the Scc(f) is somehow shifted in frequency.

My feeling is that the totally new fit of Sxx(f) from a basic set of red, green and blue as Gaussieans yield the best fit:

Sxx(f) = c1*Srr(f) + c2*Sgg(f) + c3*Sbb(f)

Hope it helps.

Mira

Subject: Fit spectrum with weighted Gaussians

From: Lara

Date: 3 Nov, 2010 15:14:04

Message: 3 of 4

Hi Mira,

Thank you for your quick reply! I think you are right but I probably should have explained what I am trying to do a bit better. The spectrum I am trying to fit is the spectrum of the sun and I want to see if I can make up a similar spectrum using different colours (represented by the gaussians).
However I need to include the white light and although it is made up of three gaussians, these don't necessarily correlate to blue, red and green, at least not to the specs of the light sources I am using. The fit will not be very good, but I am just looking for the general shape so I can measure how much intensity I will need from each light source. I think what I need to know is just how I can link the three Gaussians that make up the white light together so that when the fit varies their intensities, they will all remain in the same ratio with one another.
I'm not sure if what I want to do is possible with normal curve fitting tools, but hopefully there is some way!

Lara

"Miroslav Balda" <miroslav.nospam@balda.cz> wrote in message <iamm2k$qb7$1@fred.mathworks.com>...
> "Lara McManus" <lara_m@live.ie> wrote in message <iakrl7$2pi$1@fred.mathworks.com>...
> > I want to fit a spectrum of light using Gaussians functions to represent various components of light (blue, red etc.), but I also want this fit to include a white light source, which consists of 3 gaussians and these need to retain the same relative intensities. I have been able to uses the curvefit toolbox on Matlab to fit it with single uncorrelated gaussians, but I would like to now include the white light (with the 3 weighted Gaussians) in the analysis and was wondering if anyone has any ideas on how to do this.
> >
> > Any help or advice would be greatly appreciated!
>
> Hi Lara,
>
> I think it is a problem of linear regression.
> Say that you have 3 spectra:
> Sxx(f), a required spectrum,
> Sww(f), your spectrum of white light, and
> Scc(f), spectrum of the chosen color (a Gaussian function).
>
> The required spectrum is then
> Sxx(f) = a*Scc(f) = b*Sww(f).
> It is clear that all spectra should be defined on the same frequency interval. However, if the Scc(f) is not one of the colours contained in Sww(f), the fit might be rather bad. It would occur if the choice of the Scc(f) is somehow shifted in frequency.
>
> My feeling is that the totally new fit of Sxx(f) from a basic set of red, green and blue as Gaussieans yield the best fit:
>
> Sxx(f) = c1*Srr(f) + c2*Sgg(f) + c3*Sbb(f)
>
> Hope it helps.
>
> Mira

Subject: Fit spectrum with weighted Gaussians

From: Miroslav Balda

Date: 3 Nov, 2010 17:27:04

Message: 4 of 4

"Miroslav Balda" <miroslav.nospam@balda.cz> wrote in message <iamm2k$qb7$1@fred.mathworks.com>...
> "Lara McManus" <lara_m@live.ie> wrote in message <iakrl7$2pi$1@fred.mathworks.com>...
> > I want to fit a spectrum of light using Gaussians functions to represent various components of light (blue, red etc.), but I also want this fit to include a white light source, which consists of 3 gaussians and these need to retain the same relative intensities. I have been able to uses the curvefit toolbox on Matlab to fit it with single uncorrelated gaussians, but I would like to now include the white light (with the 3 weighted Gaussians) in the analysis and was wondering if anyone has any ideas on how to do this.
> >
> > Any help or advice would be greatly appreciated!
>
> Hi Lara,
>
> I think it is a problem of linear regression.
> Say that you have 3 spectra:
> Sxx(f), a required spectrum,
> Sww(f), your spectrum of white light, and
> Scc(f), spectrum of the chosen color (a Gaussian function).
>
> The required spectrum is then
> Sxx(f) = a*Scc(f) = b*Sww(f).
> It is clear that all spectra should be defined on the same frequency interval. However, if the Scc(f) is not one of the colours contained in Sww(f), the fit might be rather bad. It would occur if the choice of the Scc(f) is somehow shifted in frequency.
>
> My feeling is that the totally new fit of Sxx(f) from a basic set of red, green and blue as Gaussieans yield the best fit:
>
> Sxx(f) = c1*Srr(f) + c2*Sgg(f) + c3*Sbb(f)
>
> Hope it helps.
>
> Mira

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us