Transfer function from measured input signal and output signal
19 次查看(过去 30 天)
显示 更早的评论
Ill ch
2019-9-28
Dear Matlab and Simulink user,
Is there any way with parameter estimation toolbox or any another method to generate transfer function from multiple inputs and multiple outputs Signals?
4 个评论
Star Strider
2019-9-28
I never attempted to identify a MIMO system, although I suppose it is possible. (I cannot find any reference to MIMO system identification in the documentation.) See: Supported Continuous- and Discrete-Time Models for a discussion.
Ill ch
2019-9-28
Dear Star STrider,
Great your kind help.
Thank you very much for this link. Yes i found their solution for multiple input output.
with iddta one can generate data for tfest. y and u one can give as a matrix form.
Ill ch
2019-9-28
one small query if you can help me:
if i have in output signal (data1 as a time, data 2 with value) and in input signal ( data 1 just value) how i can use this ? should i need to use in bothe same time vector or sampling time is enough instead of time vector? Thank you in advance
sys = tfest(data,np,nz) ; % data from iddata(y,u,Ts)
采纳的回答
Star Strider
2019-9-28
The sampling interval ‘Ts’ is enough. Note that all your data must be sampled all with the same sampling interval. If they are not, you need to interpolate them to the same sampling interval with the resample function first.
I usually calculate the sampling interval as:
Ts = mean(diff(time));
For iddata, the output signal ‘data2’ is ‘y’, the input signal ‘data1’ is ‘u’, and ‘Ts’ is as I described it.
32 个评论
Ill ch
2019-10-4
编辑:Ill ch
2019-10-5
Hello Star,
I generated with two experiment transfer function. And results came well. Thank you for your explanation.It is Non linear model.
I have one question regarding validation for it. I want to give this generated mathematic transfer function again same input signal and want to get output signal.
Is it possible? could you plz help me. Attached my merge experiment data.
Ts = 1.67000668002672e-07; % mean(diff(t));
np=2;
nz=1;
iodelay = [];
sys = tfest(new,np,nz,iodelay,'Ts',Ts) ; % data from iddata(y,u,Ts)
sysc = d2c(sys);
Star Strider
2019-10-5
I was doing other things for most of the day yesterday.
I believe you want to simulate it.
In order to simulate your model using lsim so I can see what it does, I had to create a time vector because lsim wants one. It appears to be correct. I then used ‘u1{1}’ in the simulation, since I do not have a good idea what ‘new’ represents.
Try this:
D = load('data_collection_new_two_experiment.mat');
new = D.new;
Ts = new.Ts;
% Q = get(new); % See What’s Inside ...
u1 = new.InputData;
U1 = u1{1};
U2 = u1{2};
t = linspace(0, numel(u1{1}), numel(u1{1}))*Ts{1};
Ts = 1.67000668002672e-07; % mean(diff(t));
np=2;
nz=1;
iodelay = [];
sys = tfest(new,np,nz,iodelay,'Ts',Ts) ; % data from iddata(y,u,Ts)
sysc = d2c(sys);
[y,t] = lsim(sysc,u1{1},t(:));
figure
plot(t, y)
grid
I would experiment by increasing the numbers of poles and zeros to see what gives you the best results, since there appears to be a resonance at the end of the simulation that (if I remember correctly) does not appear in your original signal. Adding a single extra pole, increasing ‘np’ to 3 (the extra pole would appear at 0 Hz and so have only a real component), actually appears to reproduce your signal a bit better.
As for comparing the data with your simulation, plot them against one another. The straighter the line, and the closer the slope to 1, the better the simulation. This is qualitative rather than quantitative, however it gives you an easy way to visually compare them. (You can use quantitative approaches, such as correlation, later to numerically assess the comaprison.)
I may not understand your data well enough to re-create what you intend, so experiment to get the result you want.
Star Strider
2019-10-5
I would experiment with fewer poles and zeros.
Also, you mentioning ‘filtering’ the output. I am not certain how you are filtering it, however note that the filter function itself introduces phase delay and phase distortion, as do most filters, the hardware Bessel filter being the exception. (The filtfilt function is therefore preferable for discrete filtering.)
Star Strider
2019-10-5
I intended that you resample the data if the sampling intervals were not all the same. Essentially everything involving discrete data including filtering, control, and system identification, requires that the sampling intervals not change, and that the sampling interval be known.
Star Strider
2019-10-5
That looks to me to be reasonably good (looking only at the images you posted).
Note that by definition:
Fs = 12000;
Ts = 1/Fs;
so ‘Ts’ is not the same as the one you posted, given ‘Fs’.
Star Strider
2019-10-6
I am not certain what you are doing with the code you posted.
The point is that the sampling frequency ‘Fs’ and the sampling interval ‘Ts’ must be the reciprocals of each other. You may have to adjust the number of poles and zeros (or other parameters) to get your identified system to model your signal appropriately.
Ill ch
2019-10-21
Dear Star,
I have one question regarding simulating transfer function. I have multi experiment based transfer function. 100 inputs vs 100 outputs (based on 100 measurements). I want to simulate it all in one time like i give 100 inputs to transfer function and getting 100 outputs from it. Currently i am doing it manually like i am giving 1 input getting 1 output same for all. Is it possible to give in one time all 100 inputs and getting bunch of 100 outputs from it?
Thank you
Star Strider
2019-10-21
Not to my knowledge. You most likely would have to do this in a loop, with one iteration for each input, since the transfer fucntion is a SISO system.
Ill ch
2019-10-23
Dear Sir Star,
I have one small question based on multiple experiment on Transfer function with discret time and continous time.
I found out my results are good with continus time TF instead of discret time TF as my data is discret.
Is it possible scientifically to modelled TF for data( which are with discret time) in continus time Transfer function?
Thank you very much in advance
Star Strider
2019-10-23
I am not certain what you are doing, since continuous time models are usually implemented in hardware, and discrete time models are used with sampled signals.
Use whatever works best.
Ill ch
2019-10-29
Dear Star,
I need one small help from you. I have output data in iddata form.
K>> y{1}
ans =
Time domain data set with 500 samples.
Sample time: 8.3333e-05 seconds
Name: TransferFunction_Object
Outputs Unit (if specified)
y1
I need to extract from this data the value of the y1 as a vecor form. and then i want to convert it to cellstr from numstr.
Could you please help me? I tried this
cellstr(num2str(y{16}))
Error using num2str (line 53)
Input to num2str must be numeric.
Thank you very much in advance
Ill ch
2019-10-29
Thank you very much for your response
Name Size Bytes Class Attributes
y 1x38 342362 cell
y =
1×38 cell array
Columns 1 through 5
{500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata}
Columns 6 through 10
{500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata}
Columns 11 through 15
{500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata}
Columns 16 through 20
{500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata}
Columns 21 through 25
{500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata}
Columns 26 through 30
{500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata}
Columns 31 through 35
{500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata}
Columns 36 through 38
{500×1×0 iddata} {500×1×0 iddata} {500×1×0 iddata}
Star Strider
2019-10-29
I am still lost. I have no idea what you are doing, or what you want.
Perhaps this example will demonmstrate how do what you want:
data = iddata(rand(1,10)', (0:9)', 0.1); % Create ‘iddata’ Object
y = data.OutputData; % Get ‘OutputData’ As Double Array
with:
whos y
producing:
Name Size Bytes Class Attributes
y 10x1 80 double
Ill ch
2019-10-29
编辑:Ill ch
2019-10-29
I can explain in simple word:
Name Size Bytes Class Attributes
y 1x38 342362 cell
y is 1x38 cell arry. That means it contains 38 output values data vector. I want to have that all vectors in normal double form so that i can check the values of each. As well as i want to convert that from
ycs = cellstr(num2str(y{1})); % y{1} is not working as it works in your demonstrated code because your example
%is for one single data vector
% data = iddata(rand(1,10)', (0:9)', 0.1);
% y = data.OutputData;
% ycs = cellstr(num2str(y));
Error
cellstr(num2str(y{16})) % y{16} is the 16th data vector from y-cell array
Error using num2str (line 53)
Input to num2str must be numeric.
I hope you got my point. Thank you very much in advance for kind support and best regards
Ill ch
2019-10-31
编辑:Ill ch
2019-10-31
Dear Star,
I have question regarding sampling interval TS. as you had suggested me resampling if sampling interval not same. I have input data (600 points) which has Fs=16000 and output data (600 points) which has Fs=60000 and output has time vector also) Is it possible to give sampling interval for both Ts=1/Fs based on input data? in order to create transfer function.
Star Strider
2019-10-31
I do not understand. How is it possible to have an input sampling frequency of 16000 Hz and and output sampling frequency of 60000 Hz with the same size (600 element) vector for each?
If the vectors lengths were proportional to the sampling frequency, the resample function would work to equalise them (using the 16000 Hz sampling frequency).
This problem likely has no solution.
Ill ch
2019-10-31
编辑:Ill ch
2019-10-31
This problem arrives during measurements as when i am applying input signal with 600 points and Fs=16000 but the output measurement from real system has 60,000 Hz Fs. I done almost 200 measurements and suddenly i realize that output has not same Fs like input. I am confuse how to solve this problem to create tfest
Star Strider
2019-10-31
I doubt that a solution exists for it. This appears to be an experiment instrumentation problem that nothing in MATLAB can slavage.
Ill ch
2019-10-31
Sorry my mistake in writing:
Input signal: N=600; Fs=16000
Output signal; N=12000; Fs=50000
Is it possible to resample this? Thank you very much in advance
Star Strider
2019-10-31
The best approach would be to resample the output signal as:
[NewOutput, NewTime] = resample(output,output_time_vector,16000);
or something similar.
It is likely more accurate to downsample the signal with the higher sampling frequency to a lower sampling frequency than the reverse of that. Even after that, there remains the problem of the lengths not being equal, so there would not be a one-to-one correspondence of the input and output vectors.
It would be best to repeat the experiment, this time sampling the input and output at the same sampling frequencies so that the experiment produces reliable data and equivalent-sized vectors. It is likely not possible to salvage the present data and get anything close to a meaningful result. Repeating the experiment is likely the only option.
Ill ch
2019-11-2
thank you very much for detailed useful information. Yesterday i was thinking on this problem. I found one solution :
for example:
Input signal: Ts= 0.0000733
After resmapling Output signal Ts= 0.00007
I took the round figure for both Ts=0.00007. I do not know either it is possible in research work but i feel that is the solution which i can do. Your comment will be helpful for me on rounding the Ts.
Star Strider
2019-11-2
It may not be necessary to round it. In any event, if you want to, the easiest way to create it with:
Ts = 0.00007
is likely to use resample with
p = 700
q = 733
or the reverse of these, depending on what you started with and what you want as an output.
Ill ch
2019-12-17
Hello Star,
Could you please help me for the following question?
Thank you very very much in advance
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Transfer Function Models 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)