What are the possible invalid expressions in this equation?

2 ビュー (過去 30 日間)
hush gonzales
hush gonzales 2020 年 6 月 25 日
回答済み: dipak nigam 2020 年 6 月 25 日
n = (-20:1:20)'; n0 =t>=0; n1 =t>=10 n2 =t>=20 x = n*[n0 - n1 + 10e-0.3(n-10)(n1-n2)] plot(n,x) xlabel('n'); ylabel('x(n)'); title('x [n] = n[u(n) – u(n-10)] + 10e-0.3(n-10)[u(n-10)-u(n-20)] ');

回答 (1 件)

dipak nigam
dipak nigam 2020 年 6 月 25 日
Some suggestions -
1) MATLAB doesn't have e for exponentiation. You can use exp(arr) to get a vector with exponents of all elements.
2) You need to use * for scalar and matrix multiplication and ** for element-wise multiplication.
Keeping this in mind, the expression 10e-0.3(n-10)(n1-n2) should be written as 10*(exp(-0.3*(n-10)*(n1-n2)))
You may use the * operator instead of ** as per the structure and dimensions of your variables.
Other expressions will not raise any syntax errors if the dimensions of the vectors are taken care of.

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by