根据输入输出数据估算传递函数 [英] Estimate transfer function from input output data

查看:538
本文介绍了根据输入输出数据估算传递函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从NI-DAQ获得的两列数据矩阵.第一列是电动发电机组(带驱动器)的输出数据,第二列是输入数据(方波).我想在没有Simulink的情况下使用tfest查找传递函数.是否有可能?我有系统标识工具箱.

如何将.mat文件附加到此帖子?我关于gist的数据 https://gist.github.com/anonymous/6484844

解决方案

您已经有了正确的主意,但我不知道您遇到了什么问题. 这是解决您问题的代码,我对其进行了测试,效果很好.请注意,更简单的输入可能会为您带来更好的结果,例如,这意味着一步而不是方波.

% load your data (text file with your two columns)
load data.txt;

% sample index, reducing of input to get single step instead of square wave
x = 1:1:length(data);
data(x > 2900,:)=[];
x(x > 2900)=[];

% plot data
figure(1)
plot(x,data(:,1)); hold on
plot(x,data(:,2)); hold off

% prepare data for tftest, 100 is a random chosen sampling time
tfdata = iddata(data(:,1),data(:,2),100);

% estimate system, factor 5 -> number of poles (variable as desired)
sys = tfest(tfdata,5);

% plot step response (factor 5 comes from input)
figure(2)
step(5*sys)

极数np = 5的输出:

sys =


  From input "u1" to output "y1":
    -3.337e-05 s^4 + 1.326e-07 s^3 + 1.639e-11 s^2 + 1.221e-14 s + 1.064e-19
  ----------------------------------------------------------------------------
  s^5 + 0.005287 s^4 + 1.516e-06 s^3 + 4.517e-10 s^2 + 2.896e-14 s + 2.037e-19

Edit#2:在上一个问题中,您正在询问使用idfrd还是iddata会更好-但是您实际上是否拥有频率响应数据?如果您选择足够高的极数,我实际上认为这不会有太大的不同.只需尝试一下对您更有效的方法.解决方法是相同的.

I have a two-column matrix of data obtained from NI-DAQ. The first column is the output data of a motor-generator set (with driver) and the second column is the input data (square wave). I want to find the transfer function using tfest without Simulink. Is it possible? I have System Identification Toolbox.

How can I attach a .mat file to this post? My data on gist https://gist.github.com/anonymous/6484844

解决方案

You already got the right idea, I don't know where you got stucked. Here is the code which solves your problem, I tested it, its works fine. Be aware that a simpler input probably gets you better results, that means for example a single step instead of a square wave.

% load your data (text file with your two columns)
load data.txt;

% sample index, reducing of input to get single step instead of square wave
x = 1:1:length(data);
data(x > 2900,:)=[];
x(x > 2900)=[];

% plot data
figure(1)
plot(x,data(:,1)); hold on
plot(x,data(:,2)); hold off

% prepare data for tftest, 100 is a random chosen sampling time
tfdata = iddata(data(:,1),data(:,2),100);

% estimate system, factor 5 -> number of poles (variable as desired)
sys = tfest(tfdata,5);

% plot step response (factor 5 comes from input)
figure(2)
step(5*sys)

Edit: the output for number of poles np=5:

sys =


  From input "u1" to output "y1":
    -3.337e-05 s^4 + 1.326e-07 s^3 + 1.639e-11 s^2 + 1.221e-14 s + 1.064e-19
  ----------------------------------------------------------------------------
  s^5 + 0.005287 s^4 + 1.516e-06 s^3 + 4.517e-10 s^2 + 2.896e-14 s + 2.037e-19

Edit#2: in your previous question you were asking whether it would be better to use idfrd or iddata - but do you actually have the frequency response data? I actually don't think it should make a big difference, if you choose the number of poles high enough. Just try out what it's working better for you. The workaround is the same.

这篇关于根据输入输出数据估算传递函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆