Why is there a difference between "compare" function and "lsim" function ?
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Caroline BADER
am 23 Jun. 2020
Kommentiert: Star Strider
am 23 Jun. 2020
Hello everyone,
I am currently working on the identification of the transfer function of my model and I have troubles understanding the systemIdentification Toolbox, let me explain.
The "model output" proposed by the toolbox is what I want. I export the transfer function and use lsim to plot it on my command window but I get something else.
I assume that the function compare is what the toolbox uses to plot the function (because the plot is very similar and there is a goodness of fit coefficient) but I don't know why this type of plotting is different from the lsim type.
I'm using the same input/output data, the same transfer function, the same sample time and yet both plots are different. Here's a picture to show you :

and the code used to plot the figure:
test1 = iddata(Y5,U5,0.01); %iddata(output,input,Ts)
sys5 = tfest(test1,4,0); %tfest(model,pole,zero)
test2 = lsim(sys5,U5,T5);
figure
compare(test1,sys5)
hold on
plot(T5,test2,'r')
title({'Difference between "compare" function and "lsim" function' 'TF : 4 poles 0 zero'})
legend('Output measured','"Compare" function','"lsim" function')
Does someone know how both functions work ? Or why they are different?
It would help me a lot, thank you in advance!
0 Kommentare
Akzeptierte Antwort
Star Strider
am 23 Jun. 2020
Reading the documentation of compare and lsim, the only significant difference is that compare automatically estimates the initial states (see x0 in Output Arguments) while lsim does not, requiring that they be stated specifically, although findstates can be used to estimate them.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Time and Frequency Domain Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!