Discrete time signal defining

조회 수: 14 (최근 30일)
Nurhan Aydinalp
Nurhan Aydinalp 2021년 1월 7일
답변: Shadaab Siddiqie 2021년 4월 14일
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.

답변 (1개)

Shadaab Siddiqie
Shadaab Siddiqie 2021년 4월 14일
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.

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by