What are the possible invalid expressions in this equation?

2 vues (au cours des 30 derniers jours)
hush gonzales
hush gonzales le 25 Juin 2020
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)] ');

Réponses (1)

dipak nigam
dipak nigam le 25 Juin 2020
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.

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by