Determining several unknown variables in an equation using measured data.
18 views (last 30 days)
Show older comments
John Carroll
on 16 Jun 2021
Commented: John Carroll
on 18 Jun 2021
I am trying to calculate several unknown variable in an equation. I have measured data that is to fit an equation and I want to calculate the unknown variables. The data is measured S-Parameter data (y axis) and frequency (x axis). This data is converted to impedance and graphed with frequency on the x axis and the impedance on the y axis. This data should fit the following equation
Zd(w) is the measured data. I know f[GHz], w is the converted frequency, I can calculated C, tano is also known and j in the imaginary number. Using this data and the known values I would like to use Matlab to calculate Rc, Rf and Ls.
I have read a number of examples for doing something similar though not the same. I have an average understanding of Matlab but I am no expert and many of the answers I've read assumed a certain level of programming knowledge that I do not have.
I was hoping someone could help get me started in the right direction. I've looked at things like the cftool and optimizer but I'm not knowlegable enough to know how to use them or if that is the correct tool for this case. I've also looked at things like the nonlinear curve fitting tool with no success. Any help would be greatly apprieated.
0 Comments
Accepted Answer
Walter Roberson
on 16 Jun 2021
Create a function
function goodness = fitparameters(RcRfLs, C, f, tandelta, w, Zd)
Rc = RcRfLs(1); Rf = RcRfLs(2); Ls = RcRfLs(3);
Zd_projected = Rc + Rf and so on
goodness = sum( (Zd_projected - Zd).^2 );
end
Now in the function that sets up all of the input values you can create
%assign to C, f, tandelta, w, Zd before this part
obj = @(RcRfLs) fitparameters(RcRfLs, C, f, tandelta, w, Zd);
Now you can minimize obj using your favorite minimizer, such as fmincon() or fminsearch()
13 Comments
More Answers (0)
See Also
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!