Why can't I run my code? (tfest function)

8 ビュー (過去 30 日間)
Wirote Tippimarnporn
Wirote Tippimarnporn 2024 年 2 月 18 日
回答済み: Star Strider 2024 年 2 月 18 日
I can run this code below in Matlab Online. But when I run this code in Matlab application, it resulted in error.
M2 = tfest(data_training,sys_init_T1);
Error using tfest
Not enough input arguments.
How can I fix this problem? I'm so confused
x = readtable('data_thermal_pulse.txt');
time = x.Var1;
T1 = x.Var2-x.Var2(1);
input = x.Var4;
Ts = 0.07;
data = iddata(T1,input,Ts);
data_training = data(1:round(0.5*size(data,1)),:);
data_testing = data((round(0.5*size(data,1)))+1:end-1,:);
sys_T1 = idtf(NaN,[1 NaN],'ioDelay',NaN);
M1 = tfest(data_training,sys_T1);
sys_init_T1 = idtf(NaN,[1 NaN],'ioDelay',NaN);
sys_init_T1.Structure.num.Value = 0.0040;
sys_init_T1.Structure.num.Minimum = 0.0001;
sys_init_T1.Structure.den.Value = [1 0.01];
sys_init_T1.Structure.den.Minimum = [1 0.001];
sys_init_T1.Structure.ioDelay.Value = 1.96;
sys_init_T1.Structure.ioDelay.Minimum = 0.01;
sys_init_T1.Structure.ioDelay.Maximum = 2.04;
M2 = tfest(data_training,sys_init_T1);

回答 (2 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2024 年 2 月 18 日
Here it is running ok:
x = readtable('data_thermal_pulse.txt');
time = x.Var1;
T1 = x.Var2-x.Var2(1);
input = x.Var4;
Ts = 0.07;
data = iddata(T1,input,Ts);
data_training = data(1:round(0.5*size(data,1)),:);
data_testing = data((round(0.5*size(data,1)))+1:end-1,:);
sys_T1 = idtf(NaN,[1 NaN],'ioDelay',NaN);
M1 = tfest(data_training,sys_T1)
M1 = From input "u1" to output "y1": 0.003866 exp(-1.96*s) * ------------ s + 0.009965 Continuous-time identified transfer function. Parameterization: Number of poles: 1 Number of zeros: 0 Number of free coefficients: 2 Use "tfdata", "getpvec", "getcov" for parameters and their uncertainties. Status: Estimated using TFEST on time domain data "data_training". Fit to estimation data: 90.13% FPE: 0.0001156, MSE: 0.0001156
sys_init_T1 = idtf(NaN,[1 NaN],'ioDelay',NaN);
sys_init_T1.Structure.num.Value = 0.0040;
sys_init_T1.Structure.num.Minimum = 0.0001;
sys_init_T1.Structure.den.Value = [1 0.01];
sys_init_T1.Structure.den.Minimum = [1 0.001];
sys_init_T1.Structure.ioDelay.Value = 1.96;
sys_init_T1.Structure.ioDelay.Minimum = 0.01;
sys_init_T1.Structure.ioDelay.Maximum = 2.04;
M2 = tfest(data_training,sys_init_T1)
M2 = From input "u1" to output "y1": 0.003869 exp(-2.04*s) * ------------ s + 0.009975 Continuous-time identified transfer function. Parameterization: Number of poles: 1 Number of zeros: 0 Number of free coefficients: 2 Use "tfdata", "getpvec", "getcov" for parameters and their uncertainties. Status: Estimated using TFEST on time domain data "data_training". Fit to estimation data: 90.16% FPE: 0.0001151, MSE: 0.000115
  2 件のコメント
Wirote Tippimarnporn
Wirote Tippimarnporn 2024 年 2 月 18 日
This is my result
升 毕
升 毕 2024 年 2 月 18 日
I also run this code without error on matlab2021b and 2018b. M1 and M2 is the same as @Sulaymon Eshkabilov

サインインしてコメントする。


Star Strider
Star Strider 2024 年 2 月 18 日
Run this from a script or your Command Window:
which tfest -all
/MATLAB/toolbox/ident/ident/tfest.m
It should give you this identical result. If it shows anything else, that is likely the problem. The solution is to re-name any other scripts, variables, or functions that are not in the System Identification Toolbox to something that makes sense in the context you are using them in, and do not overshadow any MATLAB functions.
.

カテゴリ

Help Center および File ExchangeTransfer Function Models についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by