Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Help needed with Non-Linear Least Square Fitting

Subject: Help needed with Non-Linear Least Square Fitting

From: Nima Azar

Date: 15 May, 2008 19:49:02

Message: 1 of 6

Hi Guys,
So I'm measuring Reflectance(v2) vs. Wavelength(v1) and
need to find the thickness of my sample, for that I'm
trying to use fitting to a function using the nonlinear
square method to find couple of unknowns.
If anyone can help please email me at nimakev@yahoo.com so
I'll send you more information,
any help is greatly appericiated.
 
thank you.

Subject: Re: Help needed with Non-Linear Least Square Fitting

From: Nima Azar

Date: 15 May, 2008 19:57:01

Message: 2 of 6

"Nima Azar" <nimakev@yahoo.com> wrote in message
<g0i43e$n5i$1@fred.mathworks.com>...
> Hi Guys,
> So I'm measuring Reflectance(v2) vs. Wavelength(v1) and
> need to find the thickness of my sample, for that I'm
> trying to use fitting to a function using the nonlinear
> square method to find couple of unknowns.
> If anyone can help please email me at nimakev@yahoo.com
so
> I'll send you more information,
> any help is greatly appericiated.
>
> thank you.

So Here's the Function:
v2 = -a – b*v1 – c*(v1)^2 + d[1+(e/2d)cos((16.745*g/v1) +
h)] Exp(-j/(v1)^2)

so basically g and h are to be found through fitting...

thanks for helps.

Subject: Re: Help needed with Non-Linear Least Square Fitting

From: Roger Stafford

Date: 15 May, 2008 20:00:04

Message: 3 of 6

"Nima Azar" <nimakev@yahoo.com> wrote in message <g0i43e$n5i
$1@fred.mathworks.com>...
> Hi Guys,
> So I'm measuring Reflectance(v2) vs. Wavelength(v1) and
> need to find the thickness of my sample, for that I'm
> trying to use fitting to a function using the nonlinear
> square method to find couple of unknowns.
> If anyone can help please email me at nimakev@yahoo.com so
> I'll send you more information,
> any help is greatly appericiated.
>
> thank you.
-------------
  I'm afraid my physics is a little rusty at this point. You need to tell in what way
sample thickness is to depend on reflectance and wavelength in your fitting
model.

Roger Stafford

Subject: Re: Help needed with Non-Linear Least Square Fitting

From: Nima Azar

Date: 15 May, 2008 20:15:08

Message: 4 of 6

"Roger Stafford"
<ellieandrogerxyzzy@mindspring.com.invalid> wrote in
message <g0i4o4$2lt$1@fred.mathworks.com>...
> "Nima Azar" <nimakev@yahoo.com> wrote in message
<g0i43e$n5i
> $1@fred.mathworks.com>...
> > Hi Guys,
> > So I'm measuring Reflectance(v2) vs. Wavelength(v1) and
> > need to find the thickness of my sample, for that I'm
> > trying to use fitting to a function using the nonlinear
> > square method to find couple of unknowns.
> > If anyone can help please email me at nimakev@yahoo.com
so
> > I'll send you more information,
> > any help is greatly appericiated.
> >
> > thank you.
> -------------
> I'm afraid my physics is a little rusty at this point.
You need to tell in what way
> sample thickness is to depend on reflectance and
wavelength in your fitting
> model.
>
> Roger Stafford
>

Thanks Roger for your reply:

Here's the Function:
v2 = -a – b*v1 – c*(v1)^2 + d[1+(e/2d)cos((16.745*g/v1) +
h)] Exp(-j/(v1)^2)

so basically g and h are to be found through fitting...and
I can get V1, V2 through measurments...

thanks for help.


Subject: Re: Help needed with Non-Linear Least Square Fitting

From: Roger Stafford

Date: 15 May, 2008 22:12:01

Message: 5 of 6

"Nima Azar" <nimakev@yahoo.com> wrote in message <g0i5kc$pjn
$1@fred.mathworks.com>...
> Thanks Roger for your reply:
>
> Here's the Function:
> v2 = -a – b*v1 – c*(v1)^2 + d[1+(e/2d)cos((16.745*g/v1) +
> h)] Exp(-j/(v1)^2)
>
> so basically g and h are to be found through fitting...and
> I can get V1, V2 through measurments...
>
> thanks for help.
-------------
  If you have the Optimization Toolbox, one way is to use 'fsolve'.

  In case you don't have that toolbox, I notice that the equation can be
reformulated to look like this:

 A*g+h = B

where A and B are column vectors that depend on the various values of V1
and V2. This is done by solving for the cosine expression in terms of
everything else and then taking the arccosine of both sides. In this form it is
a standard linear least squares problem for which you can use matlab's
backslash operator. You will have to ensure that the arccosine values you
obtain in B lie in the appropriate angular range so that realistic values of g
and h are obtained.

Roger Stafford

Subject: Re: Help needed with Non-Linear Least Square Fitting

From: aasim Azooz

Date: 16 May, 2008 13:42:01

Message: 6 of 6

"Roger Stafford"
<ellieandrogerxyzzy@mindspring.com.invalid> wrote in
message <g0i4o4$2lt$1@fred.mathworks.com>...
> "Nima Azar" <nimakev@yahoo.com> wrote in message
<g0i43e$n5i
> $1@fred.mathworks.com>...
> > Hi Guys,
> > So I'm measuring Reflectance(v2) vs. Wavelength(v1) and
> > need to find the thickness of my sample, for that I'm
> > trying to use fitting to a function using the nonlinear
> > square method to find couple of unknowns.
> > If anyone can help please email me at nimakev@yahoo.com
so
> > I'll send you more information,
> > any help is greatly appericiated.
> >
> > thank you.
> -------------
> I'm afraid my physics is a little rusty at this point.
You need to tell in what way
> sample thickness is to depend on reflectance and
wavelength in your fitting
> model.
>
> Roger Stafford
>
Try the following
write and save the following M-file
function f=v2(p,v1)
g=p(1);
h=p(2)
v2 = -a – b*v1 – c*(v1)^2 + d[1+(e/2d)cos((16.745*g/v1) +
h)] Exp(-j/(v1)^2)

on matlab main work space type
p=[1 1];
p=nlinfit(v1,v2,'f',p)
this should give you the best fitted parameters g=p(1) and
h=p(2)
please tell me how do you find thickness from reflectance I
need to know that
Aasim Azooz

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics