What the calc is this?

2 次查看(过去 30 天)
Matheus Tirado
Matheus Tirado 2023-6-28
p=[1 -1 -2];
Roots(p)
i=0:20
yi=A1*z^i+A2*z^i;
stem(yi)
B=[1 1],
A=[1];
N=1:50;
Xn=cos(pi*n)
Yn=filter(b,a,xn);
Stem(n,yn)
  4 个评论
DGM
DGM 2023-11-29
Google doesn't have this cached (maybe it got purged). Is there a way these things can be reverted from the database?

请先登录,再进行评论。

回答(1 个)

Keerthi Reddy
Keerthi Reddy 2023-6-30
Hi Matheus, It is my understanding that you want to know what the above-mentioned calculation represents.
Here is the answer:
p = [1 -1 -2];
r = roots(p);
disp(r);
To calculate the roots of a polynomial 'p', you can use the “roots” function in MATLAB. The output will be the roots of the polynomial 'p'. You can go through this documentation to know more: Polynomial roots - MATLAB roots - MathWorks India
z = 0.9; % Choose a value for z
A1 = 1; % Choose a value for A1
A2 = 2; % Choose a value for A2
i = 0:20;
yi = A1*z.^i + A2*z.^i;
stem(i, yi);
The above code generates a sequence yi = A1*z^i + A2*z^i for i ranging from 0 to 20 and plots it using a stem plot. You can go through the documentation to know more: Plot discrete sequence data - MATLAB stem - MathWorks India
If you have a transfer function defined by numerator B and denominator A, and you want to filter a sequence xn using this transfer function, you can use the filter function. The following code does the same. B = [1 1];
A = [1];
n = 1:50;
xn = cos(pi*n);
yn = filter(B, A, xn);
stem(n, yn);
You can go through this documentation to know more: 1-D digital filter - MATLAB filter - MathWorks India.
Hope this helps .

标签

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by