Grey Box Model code error

Hello everyone. So I am new to using the SSID toolbox and I'm getting some error codes when I run the script.(These are the two errors) "Error using iddata/greyest (line 40) When estimating a discrete time model, the sample time of the model must match that of the estimation data.
Error in Idgrey (line 31) model = greyest(data,model,opt);"
My code is as follows:
function [A,B,C,D] = System(c1,c2,c3,c4,Ts)
A = [0 1 0; 0 0 1; -(c4/c1) -(c3/c1) -(c2/c1)];
B = [0 ; 0; (1/c1)];
C = zeros(1,3);
D = zeros(1,1);
end
clear all; close all; clc
load DataNew2.mat
outdoor= DataNew2(:,1);
indoor = DataNew2(:,2);
data = iddata(indoor,outdoor,1,'Name','Temp Data');
data.OutputName = 'Indoor Temperature';
data.OutputUnit = 'Celcius';
data.InputName = 'Outdoor Temperature';
data.InputUnit = 'Celcius';
data.Tstart = 1;
data.TimeUnit = 'h';
c1 = 1;
c2 = 1.5;
c3 = 19;
c4 = 1.5;
model = idgrey('myfunc',{c1,c2,c3,c4},'d');
model.Structure.Parameters(1).Free = true;
model.Structure.Parameters(2).Free = true;
model.Structure.Parameters(3).Free = true;
model.Structure.Parameters(4).Free = true;
opt = greyestOptions('InitialState','estimate','Display','on');
opt.EnforceStability = true;
model = greyest(data,model,opt);
% b_est = model.Structure.Parameters(4).Value;
% [b_est,d_b_est] = getpvec(model,'free')
compare(data,model)
Just to explain somethings. DataNew2.mat is a 288 by 2 matrix of temperature data. I reference outdoor and indoor temperature to its corresponding columns.
Once I run the script and print "data" it says,
Time domain data set with 288 samples.
Sample time: 1 hours
Name: Temp Data
Outputs Unit (if specified)
Indoor Temperature Celcuis
Inputs Unit (if specified)
Outdoor Temperature Celcius
So I'm really not too sure where I'm getting an error. I have 4 coefficients that I need to be guessed. One of the errors is saying that my estimation data isn't the same size but I have no idea where to put the sample time to be 1 to 288 (because I have 288 data observations).

1 comentario

Ljuboslav Boskic
Ljuboslav Boskic el 11 de En. de 2018
Editada: Ljuboslav Boskic el 11 de En. de 2018
model =
Discrete-time linear grey-box model defined by "myfunc" function:
x(t+Ts) = A x(t) + B u(t) + K e(t)
y(t) = C x(t) + D u(t) + e(t)
A =
x1 x2 x3
x1 0 1 0
x2 0 0 1
x3 -1.5 -19 -1.5
B =
u1
x1 0
x2 0
x3 1
C =
x1 x2 x3
y1 0 0 0
D =
u1
y1 0
K =
y1
x1 0
x2 0
x3 0
Model parameters:
Par1 = 1
Par2 = 1.5
Par3 = 19
Par4 = 1.5
Sample time: unspecified
Parameterization:
ODE Function: myfunc
Disturbance component: none
Initial state: 'auto'
Number of free coefficients: 4
Use "getpvec", "getcov" for parameters and their uncertainties.
Status:
Created by direct construction or transformation. Not estimated.
>>
And this is what the "model" print says. I'm really not sure what the problem is because I need a discrete time system and A,B,C,D matrices are correct.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Productos

Preguntada:

el 11 de En. de 2018

Editada:

el 11 de En. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by