What are the possible invalid expressions in this equation?

2 visualizaciones (últimos 30 días)
hush gonzales
hush gonzales el 25 de Jun. de 2020
Respondida: dipak nigam el 25 de Jun. de 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)] ');

Respuestas (1)

dipak nigam
dipak nigam el 25 de Jun. de 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.

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by