Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hello Everybody,
Could you please help me with this problem.
In the attached worksheet, there is function sp(k,b), where k is the variable and "b" is the parameters. for different set of parameters, there is a phase shift between sp(k,c1) and sp(k,c2).
How can I find the amount of the phase shift? or minimize the phase difference?
The ultimate goal is to find a new set of parameters as close as possible to the model parameters "c1"
Thank you very much in advance
If you want your solve block to change anything you have to make c2 an argument of residual. Otherwise c3=c2. The values seem to be too small for MAthcad to arrive at c3=c1, though.
Its not clear to me what you are trying to do. If you know c1 it would be trivial to write c3:=c1, no matter what c2 is. If you don't know c1, you cant use your function Residual() as it uses c1.
Hello Werner,
I used "c1" to generate the signal sp(k,c1). I just have sp(k,c1) as my original signal.
From the experiment I obtained parameters "c2". From the fitting procedure, I want to refine "c2" and obtain a new set as close as possible to "c1'. In other words I want to reconstruct "c1".
PAYMAN RAJAI wrote:
Hello Werner,
I used "c1" to generate the signal sp(k,c1). I just have sp(k,c1) as my original signal.
From the experiment I obtained parameters "c2". From the fitting procedure, I want to refine "c2" and obtain a new set as close as possible to "c1'. In other words I want to reconstruct "c1".
Yes of course! My fault.
Did you try to add c2 as argument to residual()?
You get just very small changes of your guess values c2 and I am not sure if some scaling would help.
Here. It doesn't really help though. The changes to the parameters are very small. That may be because it got stuck in a local minimum though. You have already established that the least squares solution to this problem has very many local minima, and I pointed out that iterative least squares minimization is therefore not a good way to solve this problem.
Could it be that that something went wrong when deriving the paramters c2? Some sort of index 0 vs index 1 confusion?
At least its noticeable that the shift seems to be close to the difference of subsequent values in k and if you compensate for that the fit looks pretty good.
I've looked at this "data" many times now (see Payman's other posts). There is a phase shift between the "data" and the model, but it changes with k. So I can tweak the parameters to reduce the residuals in one region, but they just increase somewhere else. I suspect that this is why the least squares problem has a really large number of local minima (again, look at Payman's other posts). Maybe there's an error in the way the data was created, but I have not gone through the program that creates it because I don't know what it is supposed to do, and therefore it's not possible for me to find any mistake. Or maybe the "data" is correct, and the model is correct (in the sense that the form of the model really is what is required, not that it fully explains the "data"), in which case non-linear least squares is just the wrong way to find the optimal model parameters. It just drops into one of a multitude of local minima and stops. Or maybe the model is just not good enough. Or maybe some combination of the above! Without more information about what this "data" is supposed to represent I fear we will just continue to go in circles.
Points I noted:
It looks like you are looking at the beat frequency of an 800nm light beam within a 50nm square bandwidth.
The use of 'nm' (10^-9) makes the numbers small which can be a difficulty for some of the internal routines which have a hard coded (mathematicians) limit of circa 10^-15 (numerical methods mathematician, unlike scientists and engineers, like numbers to be always near unity 😉
I don't see the parameter b[0 being used in the model equation, which means that mathcad is waggling that value (probably first) to get a minima it will never find (because it has no effect)
You have a couple of terms which are difference scaled (b[1 - b[2) etc. It is the difference that will (most likely) be critical to the solution. Why not reframe the model equation in terms of those deltas (perhaps even pre-scale them!).
The model may be a poor fit for the experiment:: Open questions -
A. Are these real results you took from a real instrument, or results given to you (perhaps from a professor/lecturer) that may actually be from a model they made. If the latter you should be able to get a good match. If the former then your model may be too idealistic.
B. If model data, is this a question about the physics, or about the computation accuracy. The model data will be set up to illustrate the point they require.
Finally, Phase is a tricky concept when applied to broadband signals (rather than super narrow band signals)
Philip
Payman, You left your annotations on, so the source filename is visible for the two layer thin film worksheet.
Though more awkwardly, the symbolic solver for the main equation ends up believing it is a recursive definition. - I was using it to see if the terms simplified. You do have to pre-define k:=k to avoid it trying to compute a vastly large symbolic solution.
The (zr-zs[0) terms are also zero, so these terms disappear - is that what you wanted?
Philip
Thank you Philip, I appreciate your hints.
My data is a computer generated data which is the reflection spectrum of a broadband light from a two layer
system. From the spectrum, I want to reconstruct the object refractive indices and thicknesses.
Would you please expalin more about your comment:"You have a couple of terms which are difference scaled (b[1 - b[2) etc. It is the difference that will (most likely) be critical to the solution. Why not reframe the model equation in terms of those deltas (perhaps even pre-scale them!)."
Also I don't understand your comment "You do have to pre-define k:=k to avoid it trying to compute a vastly large symbolic solution". I checked my program and it always consider "k" as what I defiend.
the term (zr-zs[0) has been set to zero for simplification.
Finally, would you please let me know how to obtain the beating frequency?
Thank you very much in advance
Do you mean two layers on a substrate, which has refractive index n0? What are the assumptions in your computer generated data? Constant refractive index for both layers? Lastly, have you tried this, and got it to work, for a one layer system?
Intuitively, it seems to me that what you are trying to do is not possible. The fringe spacing depends on the optical pathlength, which depends on the refactive index and the layer thickness. But with only a single spectrum you have no way to separate the contributions from the refractive index and the thickness.
Hi Payman,
The comment about the difference term was one about making the numerical solving easier.
It is much better for the solver to have an n0, and then a dn1 and a dn2, rather than having (n1-n0) and (n2-n0) terms for the three refractive indicices (base, layer1 and layer2). If you have n0, n1, n2, then the solver looses precision (as it waggles n1) relative to adjusting dn1.
It's not an exact science, but it is one tweak to make the solver more likely to work, and to allow you to see which terms are most important for determining the initial guess.
The comment about k=k was relative to using the symbolic solver, that is, a solver that simplifies the expressions (Once you understand the basics of what it is doing it is magic, in both senses of the word ;-).
With the symbolic solver you can get mathcad to manipulate your equations for you, and check that they mean what you expect (e.g. don't simplify to identically zero because you have substituted your original equation back in for one of the variable and can't see the wood for the trees).
Finally, if you are happy to do so, it would be worth showing the whole 'experiment' and formula derivation, as a few of us here have had some experience in optical systems... It sound like you may have an X-Y Problem http://meta.stackexchange.com/a/66378.
Philip