# Fminsearch results shows shift from measured curve. How should I solve this?

4 views (last 30 days)
Amit Das on 23 Jan 2023
Edited: Matt J on 23 Jan 2023
I am working with several measurement data which I am reading through matlab and then using Fminsearch to estimate through different model equations to fit with the measurement data. But fminsearch is giving a shift from the measured data as shown in picture. Blue one is the measured curve and orange one is the fminsearch estimation. How should I solve this? I am a beginner so would be helpful with some guidance. Thank you.
My sample of fminsearch:
Amit Das on 23 Jan 2023
Hi the values needed to run the codes can be found in this excel file. Just run and plot should help.
time =daten(:,1);
position = daten(:,2);
torque = daten(:,3);

Matt J on 23 Jan 2023
Edited: Matt J on 23 Jan 2023
The x_Start=[1,1] selection looks very arbitrary. If one of the parameters is the oscillation amplitude, it should be closer to 0.4.
Other than that, though, there is too little information to diagnose. We would need to see the full code including the FitnessFunction (and as text, not a screenshot).
Matt J on 23 Jan 2023
Edited: Matt J on 23 Jan 2023
I notice that the least squares prediction F can be written as a linear combination of known things.
Q= abs(v) .* z ./ (Fc + (Fs - Fc) * exp(r));
zdot = v - sigma0*Q;
F = sigma0 * (z+zdot.*ts) + sigma1 * z_dot + sigma2.*v; % eq. 3
= sigma0*(z + v) - sigma0^2.*Q.*ts - sigma0*sigma1.*Q + (sigma1+sigma2)*v
= C1*(z + v) - C2.*Q.*ts - C3.*Q + C4*v
So, you can solve for C1 .. C4 by solving a set of linear equations.
Then, from the C coefficients, you can easily solve for sigma0 and sigma1.
Then, you can use that as an initial guess for the original optimization.

### Categories

Find more on Solver Outputs and Iterative Display in Help Center and File Exchange

R2021b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!