What are the possible invalid expressions in this equation?
2 次查看(过去 30 天)
显示 更早的评论
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)] ');
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!