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 Center および File ExchangeConversion 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