how to create an discrete equation

25 次查看(过去 30 天)
my question is how to creat discrete equations, calculate them and put the created discrete equations in each other such that i get an final diskrete equation
For example:
I. y_1(k) = a*y_1(k-1)+b*x_1(k-1)
II. y_2(k) = c*y_2(k-1) + d*y_1(k-1)
Final equation: y_2(k) = c*y_2(k-1) + d*a*y_1(k-2) + d*b*x_1(k-2)
** The values of x_1, i can get from the data set x_1 and for k = 1, y_1(k-1) = 0
** I would like to realize it into "sym".
thank you in advance

回答(1 个)

Surya Talluri
Surya Talluri 2020-8-10
I understand that you want to create discrete functions using Symbolic Math Toolbox. You can implement it by creating symbolic functions x_1(k), y_1(k), y_2(k)
syms a b c d x_1(k) y_1(k) y_2(k)
y_1(k) = a*y_1(k-1)+b*x_1(k-1);
y_2(k) = c*y_2(k-1) + d*y_1(k-1);
y_2(k)
ans =
c*y_2(k - 1) + d*(a*y_1(k - 2) + b*x_1(k - 2))
For replacing x_1 values, you can use “subs” function.
You can refer to following documentation for further understanding:

类别

Help CenterFile Exchange 中查找有关 Formula Manipulation and Simplification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by