Clear Filters
Clear Filters

How to get correct parameter values using greyest() function?

3 views (last 30 days)
I'm using greyest() to find the correct parameter values of a transfer function. I have the input signal and the response of a Grey-Box dynamic system. Follows the code:
tsample = in.t(2)-in.t(1);
data = iddata(out.v,in.v,tsample);
Rf = 600e6;
Cf = 0.6e-9;
Rin = 0.56e3;
parameters = {'Rin',Rin;'Rf',Rf;'Cf',Cf};
sys = idgrey('amplif',parameters,'d',{},tsample);
opt = greyestOptions;
opt.InitialState = 'auto';
opt.SearchOptions.MaxIterations = 200;
opt.SearchOptions.Tolerance = 1e-200;
opt.Display = 'on';
opt.SearchMethod = 'grad';
Model = greyest(data,sys,opt)
Unable to resolve the name 'out.v'.
Folllows the function "amplif.m":
function [A,B,C,D] = amplif(Rf, Cf, Rin, Ts)
% ODE function for computing state-space matrices as functions of parameters
Ac =[-(Cf*Rf + 2218.8e-12*Rin)/(Cf*2218.8e-12*Rf*Rin) -1/(Cf*2218.8e-12*Rf*Rin); 1 0];
Bc = [1; 0];
Cc = [-1/(Cf*Rin) 0];
Dc = 0;
% Discretize
sysc = ss(Ac,Bc,Cc,Dc);
sysd = c2d(sysc,Ts,'least-squares');
[A,B,C,D] = ssdata(sysd);
I haven't found any problems with my code, although the output is always being the same values as initial parameters (Rf, Cf and Rin).
How to solve this problem!?

Answers (1)

Shubham
Shubham on 8 Mar 2023
Hi Caio,
The error message "Unable to resolve the name 'out.v'" suggests that there is a problem with the input and output signals provided to the iddata function.
One possible explanation is that the variable out is not defined before calling iddata. Double-check that the variable out contains the output signal data before calling iddata.
Another possibility is that the variable in is not defined with the correct time vector. Make sure that in contains the input signal data and has the correct time vector.
In addition, you may want to check the units of the parameters used in the amplif function. Make sure that they are consistent with the input and output signals. For example, if the input and output signals are in volts, then the parameters should be in units of ohms and farads.
Finally, you may want to experiment with different optimization options in the greyestOptions object, such as changing the maximum number of iterations or the search method.
Overall, debugging grey-box system identification can be a complex process, and it may require careful examination of the data, model structure, and optimization algorithm to identify and fix any issues.

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!