Using equation from curve fitting toolbox as transfer function

Hello,
I think this question has been asked multiple times in different ways, but I still could not find the answer to my problem. I have a numerical dataset x and y, where y/x = transfer_function. Using curve fitting toolbox I plotted the y vs x. Using the spline function I have a good fit to the data. Now transfer_function in this case is spline function. I would like to use this function as a transfer function in my Matlab script such that change in x values should give me corresponding y values. How do I use the output of cftool as a transfer function ?

2 件のコメント

Birdman
Birdman 2017 年 10 月 20 日
Can you share the x and y datas as a mat file?
RAN
RAN 2017 年 10 月 20 日
Unfortunately I cannot share the data files. But as you can see that there is a function for f(x) in the results pane. I am just not sure how to use that as a transfer function in my matlab script.

サインインしてコメントする。

 採用された回答

Birdman
Birdman 2017 年 10 月 20 日

0 投票

To use it as a transfer function, you need to obtain a model from input/output data. To do that, you can use the SYSTEM IDENTIFICATION TOOLBOX, where you can obtain a model in s-domain at a order that you define. That is the only way I can help.

4 件のコメント

RAN
RAN 2017 年 10 月 20 日
編集済み: RAN 2017 年 10 月 20 日
Hello, Thank you for the information. If i generate the code from cftool i get the following output:
% Fit: 'untitled fit 1'.
[xData, yData] = prepareCurveData( x_transient, y_transient );
% Set up fittype and options.
ft = fittype( 'smoothingspline' );
opts = fitoptions( 'Method', 'SmoothingSpline' );
opts.Normalize = 'on';
opts.SmoothingParam = 0.99999132106058;
% Fit model to data.
f = fit( xData, yData, ft, opts );
% Plot fit with data.
figure( 'Name', 'untitled fit 1' );
h = plot( f, xData, yData );
legend( h, 'y_transient vs. x_transient', 'untitled fit 1', 'Location', 'NorthEast' );
% Label axes
xlabel x_transient
ylabel y_transient
grid on
The variable 'f' contains the transfer function. It can also be plotted using plot, which means f has numerical values in it. Now if i simply multiply x.*f then i should get y. I cannot see values of f becauuse it is not a variable. I also dont understand how plot() evaluates the values of f to plot.
edit: corrected the code
Birdman
Birdman 2017 年 10 月 20 日
Is the transfer function f in time domain or s domain? Can you display f and put it here?
RAN
RAN 2017 年 10 月 20 日
the 'untitled fit 1' is the data in variable f
Birdman
Birdman 2017 年 10 月 20 日
If we talk about a transfer function, than it has to be in s-domain. The f variable behaves like a equation which firs the IO data.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSpline Postprocessing についてさらに検索

質問済み:

RAN
2017 年 10 月 20 日

コメント済み:

2017 年 10 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by