Solving for multiple variables

4 views (last 30 days)
Nathan
Nathan on 18 Oct 2012
Commented: Prathap on 15 Sep 2014
Hi,
I am trying to solve the Magic Formula (tire simulation) for the variables B, C, D and E in the equation below. I have been given a set of X and Y values. I am not very familiar with MATLAB and don't know where to start. Any feedback would be very helpful.
Y=D*sin[C*arctan{(1-E)*B*X+E*arctan(B*X)}]
  1 Comment
Prathap
Prathap on 15 Sep 2014
Hi all, I am working on similar problem. I have to find the equation using magic formula to model a friction damper to be used in ADAMS software for dynamic simulation. I have the damper characteristic curve from which I extracted data points. Now I have to fit a curve equation that would fit the behavior it.
If it is possible to fit any other equation (polynomial or trigonometric), would be helpful.

Sign in to comment.

Answers (2)

Star Strider
Star Strider on 19 Oct 2012
Edited: Star Strider on 19 Oct 2012
Since you have a set of (X,Y) values, my guess is that you may want to estimate the numeric values of B, C, D, and E. I suggest this approach:
% B = P(1), C = P(2), D = P(3), E = P(4)
MagicFormula = @(P,X) P(3).*sin(P(2).*atan((1-P(4)).*P(1).*X+P(4).*atan(P(1).*X))); % Anonymous function version of the Magic Formula
% Choose an appropriate initial estimate ...
Beta0 = rand(4,1);
% Then either ...
[Beta,R,J,CovB,MSE] = nlinfit(X, Y, MagicFormula, beta0);
% or ...
[Beta,resnorm,residual,exitflag,output,lambda,jacobian] = lsqcurvefit(MagicFormula, Beta0, X, Y);
% ‘Beta’ is the vector corresponding to the estimated values of B, C, D, and E
If you have more than four distinct (X,Y) data pairs, you can likely identify your parameters uniquely. Note that nonlinear curve fitting is inherently heuristic, so you may have to attempt several different sets (and perhaps magnitudes) of starting values for Beta0 to get a good fit. (If you know about what they should be, start with those values.) See the documentation for nlinfit (Statistics Toolbox) and lsqcurvefit (Optimization Toolbox) for details.

Ryan G
Ryan G on 18 Oct 2012
You have 1 equation and 4 unknowns. Assuming you have at least 4 sets of X/Y values you can split this into 4 equations with 4 unknowns.
Once you have the 4 equations you can use something like the symbolic toolbox to solve for the 4 equations.
  5 Comments
Ryan G
Ryan G on 19 Oct 2012
Edited: Ryan G on 19 Oct 2012
Shouldn't matter. See how walter's answer has 3 equations, 3 unknowns and has vectors x and y. x and y do not need to by symbolic as they are vectors of data.
Edit: Agree with Walter, what I meant was the syntax should be the same.
Walter Roberson
Walter Roberson on 19 Oct 2012
There will be some differences in output and internal workings for R2007, as R2007's Symbolic Toolbox would have been based upon Maple rather than MuPAD

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!