Parameter estimator not able to list some variables as parameter
1 次查看(过去 30 天)
显示 更早的评论
I have a simulink model which i am initialising using a matlab script (A). i have another script inside A which constructs a state space. Basically it has a variable which represents the state matrix and an input matrix which has some variables as elements. The parameter estimator tool is not able to list the variables inside those matrices since they are not model parameters. i tried to follow Matlab help which is this.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1238512/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1238512/image.png)
Before, i put these lines in the callback, i tried to run them in the command window and even before i declared them as mentioned in the help section separately like this.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1238517/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1238517/image.png)
i get this error.
>> Cp_cell_pack = evalin(wks,'Cp_cell_pack')
Unrecognized function or variable 'Cp_cell_pack'.
I also realise that these parameters which i am trying to estimate are invisible to the tool since they are not listed as model parameters. Evident here:![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1238522/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1238522/image.png)
What am i missing? Please help.
0 个评论
回答(1 个)
Akshat Dalal
2023-9-11
Hi Pranesh,
I understand you are facing an error while trying to estimate variables that are not model parameters.
You are facing this error because when you initialize your model using your MATLAB script ‘A’, the variables get stored in the ‘Base Workspace’ by default. However, in the MATLAB help code you are referring to, the variable ‘wks’ points to the ‘Model Workspace’, and thus expects your variables to be in the ‘Model Workspace’.
To load variables directly into ‘Model Workspace’ instead of ‘Base Workspace’, open Model Explorer from the view menu and then choose ‘Model Workspace’. You will see option to specify different ways for getting data on the rightmost pane. Select MATLAB File and choose your MATLAB script ‘A’ as the source.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Event Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!