how to create an discrete equation

25 views (last 30 days)
Seungil Oh
Seungil Oh on 5 Aug 2020
Answered: Surya Talluri on 10 Aug 2020
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

Answers (1)

Surya Talluri
Surya Talluri on 10 Aug 2020
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:

Community Treasure Hunt

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

Start Hunting!