10-13-2017 09:10 AM
I have made vi to optimize some data. For example, if there is a function f (a, b, c) with variables a, b, and c, the vi optimizes function and get some variable a1, b1, and c1.
However, some time I want to fix a and b except c, so that the vi optimizes the function by varying the c only.
Thank you for your future help
10-13-2017 11:52 AM
Data is data, you cannot "optimize" it after the fact. You can only optimize the parameters of a model function to better fit the data. Are you talking about fitting or optimization?
For some ideas, have a look at my NI-Week presentation.
(As an example, my spectra fitting program has several hundred parameters, and any combination of parameters can be chosen for fitting, keeping the rest constant).
10-13-2017 12:50 PM
@getdlts wrote:
I have made vi to optimize some data. For example, if there is a function f (a, b, c) with variables a, b, and c, the vi optimizes function and get some variable a1, b1, and c1.
However, some time I want to fix a and b except c, so that the vi optimizes the function by varying the c only.
I assume that you have some data and a model expressed as f(a, b, c, x) (where "a", "b", and "c" are the parameters of the model and "x" is the independent variable. I'm assuming you know about fitting your model to some set of data Y(x) in order to find values for a, b, and c that give you the "best fit" (according to some criterion that you choose, such as Least Squares).
If your question is "How do I fit my model f(a, b, c, x) with a and b fixed?", this is simple. Let's say you want to set a=3 and b=7.2, and want to find the value of c that gives you the best fit. Just run your least-squares fitting procedure, but use f(3, 7.2, c, x) as the fitting function.
For example:
f(a, b, c, x) = a + b sin (2*pi*x + c). You fit your measurements Y(x) and estimate a, b, and c. Now, however, you want to set a = 3 and b=7.2. So your fitting function becomes
f(3, 7.2, c, x) = 3 + 7.2(2*pi*x + c) = g(c, x)
You've changed the model from having 3 "free parameters" to a different model having only one.
Bob Schor
10-13-2017 01:33 PM
Hello, Altenbach?
Thank you for your kind answer.
Actually I'm trying to fit parameters and model to my real data using the "constrained nonlinear optimization.vi" (I thought the fitting and optimization are similar things.)
As you said at the end of your answer, I'd like to choose parameters, keeping the rest constant.
Could you tell me, where is the example code to apply to my purpose?
10-13-2017 03:57 PM
Have a look a slide ~21 of my presentation, to be used with nonlinear fitting (vi model).
We could help you more if you would tell us about the actual problem you are trying to solve.
10-15-2017 04:10 AM
How is your weekend? Dr. Altenbach, thank you for your reply.
In fact, I hesitated to reveal my code because it will be published in my research journal. I would appreciate your understanding of this part generously.
Attachment is fitting programs that I have been making. Please look at the readme.txt in the attachment and run the vi. When you follow it, the Plotting graph VI.vi will run automatically.
In that vi, I’d like to
The another problem is,
When the fitting is carried out with low noise data, the fitting results are well matched with expectations. However, the fitting is carried out with high noise data, the program changes the energy level only.
I think the reason is that the energy levels are more effective to change the peak shapes. For example, the required changes of parameters changing a specific position of peaks are 0.1 energy level and 1 ccs respectively. Therefore, if I give some weight on the parameters, I think the programs change the parameters evenly.
10-15-2017 05:13 AM
Why don't you create a simple state machine that does the various stages and allows you to either load data or simulate data?
I probably won't have time to study this before next week, but what exactly is the model you are trying to fit? Do you have a link to a web site?
10-19-2017 07:32 AM
Thank you for your advice,
I changed the path, revealed the event structure and replaced it to flat sequences.
You are right, I had made it too complicated. Maybe that is due to the self learning and rigid brain.
Anyway, I had tried to make it simple. Could you please solved the original problems?
Fixing parameters, deleting the row at once, and the weighting on the parameters.
01-25-2018 03:34 PM
Hi
I have a question related to these parameteres... How can I change their value at runtime ?
thanks
01-25-2018 06:11 PM
They are controls, so you can change their value on the front panel at any time. If you want to change them during optimization, you are out of luck (that's why they are called "start"). You need to start over with new start values. 😄
Maybe I don't understand the question.....