What the calc is this?
6 views (last 30 days)
Show older comments
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 Comments
DGM
on 29 Nov 2023
Google doesn't have this cached (maybe it got purged). Is there a way these things can be reverted from the database?
Answers (1)
Keerthi Reddy
on 30 Jun 2023
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 .
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!