One sys multiple validation

Hello,
I'm trying to use the compare function to compare one sysid and three validation data. But Matlab always uses z_1 for validation. Why?
Another solution could be to plot sys, z_1,z_2, and z_3 in the same window, but I need to figure out how to do this because sys is an idpoly (structure) variable.
compare(sys,z_1,z_2,z_3)

Respuestas (1)

Tianyu
Tianyu el 24 de Abr. de 2024

0 votos

Hi isabel,
compare always uses one dataset for validation. It is used to compare the performance of different models with respect to the same validation set.
compare(data, sys1, sys2, sys3)
If you want to check the performance for different data sets:
compare(z1, sys)
compare(z2, sys)
compare(z3, sys)
If you want to plot all data in one figure, you can simulate the trajectory first:
y = sim(sys,data);
plot(y.OutputData)
hold on
plot(z1.OutputData)
plot(z2.OutputData)
plot(z3.OutputData)

3 comentarios

isabel
isabel el 25 de Abr. de 2024
Hi Tianyu, Thank you!!
I want to simulate different datasets z1, z2, and z3, like the first example, but show them in the same plot. Can I do this with the compare function? Or only like the second example?
Tianyu
Tianyu el 25 de Abr. de 2024
compare function cannot be directly used for your purpose.
You need to customize your plot using the last workflow I provided.
To get fit information:
[~,fit] = compare(z1,sys)
Then you can plot all validation sets and add information using legend function.
https://www.mathworks.com/help/matlab/ref/legend.html
isabel
isabel el 28 de Abr. de 2024
Thank you! That was very helpful!

Iniciar sesión para comentar.

Categorías

Etiquetas

Preguntada:

el 23 de Abr. de 2024

Comentada:

el 28 de Abr. de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by