Filter löschen
Filter löschen

Discrete time signal defining

16 Ansichten (letzte 30 Tage)
Nurhan Aydinalp
Nurhan Aydinalp am 7 Jan. 2021
Beantwortet: Shadaab Siddiqie am 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.

Antworten (1)

Shadaab Siddiqie
Shadaab Siddiqie am 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.

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by