我正试图在matlab中绘制矩形脉冲,但不幸的是,我收到了以下消息错误:
T=sym('T','real');
>> t=-5*T:1/2*T:5*T;
>> y=5*rectpuls(t,T);
??? Error using ==> sym.sym>notimplemented at 2621
Function 'lt' is not implemented for MuPAD symbolic objects.
Error in ==> sym.sym>sym.lt at 812
notimplemented('lt');
Error in ==> rectpuls at 22
y = abs(t)<Tw/2-eps;
哪个可能是错误的?
这是因为rectpuls
不意味着接受符号,它必须接受数字。
您必须将T
设置为实际数字(矩形脉冲的宽度)。
T = 5;
t=-5*T:1/2*T:5*T;
y=5*rectpuls(t,T);
请参阅rectpuls
文档。
T = 2.5; % Period
dutyCycle = 1.9; % Duty Cycle
t = 0:0.0001:10;
y = heaviside(dutyCycle -(t - T*floor(t/T)));
plot(t, y)
ylim([-0.5, 1.5])
T=2.5;%周期
dutyCycle=1.9;%工作循环
t=0:0.0001:10;
y=重型(dutyCycle-(t-t*地板(t/t));
图(t,y)
ylim([-0.5,1.5])