矩形函数的乘法-MATLAB

时间:2019-02-26 11:33:52

标签: matlab

我想知道是否有可能将一个函数与squarePulse相乘。

我试图编写这段代码,但这是错误的:

Tc = 0.01;                         
t = [0:Tc:3];
y = t.^2 * rectangularPulse(1,2,t);

你能告诉我是否有解决方案(我想使用rectanglePulse,而不是其他功能)?

错误如下:

Error using  * 
Inner matrix dimensions must agree.

Error in aaa (line 12)
y = t.^2 * rectangularPulse(1,2,t);

谢谢您的时间。

1 个答案:

答案 0 :(得分:3)

乘法应该是逐元素乘法:

y = t.^2 .* rectangularPulse(1,2,t);