To confirm: you want to optimize so that C, D, E are the same for all datasets, but A and B vary according to the datasets?
There are two possibilities for this:
- do a full fit for one dataset, record the C, D, E; for the rest of the datasets, provide a function which treats C D E as constants (for example fmincon and set UB same as LB for those variables). This approach will only work if the C, D, E obtained by fitting one dataset is certain to be the "best" C D E for all of the datasets.
- Or... fit everything at one time, supplying a fitness function that uses a global C D E but uses different A and B for different sections of the signal.