Azzera filtri
Azzera filtri

Discrete time signal defining

14 visualizzazioni (ultimi 30 giorni)
Nurhan Aydinalp
Nurhan Aydinalp il 7 Gen 2021
Risposto: Shadaab Siddiqie il 14 Apr 2021
I am trying to define a discrete time in which n = [-5:1:5] and the values of x[n] should be 1 2 3 4 5 6 5 4 3 2 1 I have the following code
syms x(n) n h(n) y(n)
n = (-5:1:5);
x(n) = [1 2 3 4 5 6 5 4 3 2 1];
plot(x(n),n)
But When I run this I get the following error:
Error using sym/subsasgn (line 963)
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be
symbolic variables, and function body must be sym expression.

Risposte (1)

Shadaab Siddiqie
Shadaab Siddiqie il 14 Apr 2021
From my understanding you are getting an error for the above code. This is because you are assigning non symbolic variables to a symbolic variable in line :
x(n) = [1 2 3 4 5 6 5 4 3 2 1];
Please refer syms for more information.

Community Treasure Hunt

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

Start Hunting!

Translated by