使用更多的“自然"字样在Matlab MuPAD中操作分段步进函数的形式? [英] Use more "natural" form to manipulate piecewise step functions in Matlab MuPAD?
问题描述
我具有单位步进功能:
u0:= piecewise([-infinity < t and t < 0,0],[0 < t and t < infinity,1]):
现在我想在某个时候绘制它:
Now I want to plot it at some point:
T:=1:;
plot(u0|t=t-T/2);
这有效.但是当我使用更自然的表达方式时:
This works. But when I use a more natural expression:
T:=1:;
plot(u0(t-T/2));
它只是绘制了原始的未移动阶跃函数.
it simply plots the original unshifted step function.
在绘制修改后的阶跃函数时,有什么方法可以使用更简单的形式?
Is there any way to use the more simpler form when plotting the modified step function?
推荐答案
我相信您所说的更自然的形式"不起作用的原因是,因为u0
尚未定义为 MuPad函数/过程.在这种情况下,您可以使用 ->
运算符创建一个过程. :
I believe the reason that what you call the "more natural form" doesn't work, is because u0
has not been defined as a MuPad function/procedure. In this case, you can create a procedure using the ->
operator:
u0 := t -> piecewise([-infinity < t and t < 0, 0], [0 < t and t < infinity, 1]):
请注意,上述内容等同于u0 := t -> piecewise([t < 0, 0],[t > 0, 1]):
(我假设您已经知道未定义0
).然后,您应该能够进行评估:
Note that the above is equivalent to u0 := t -> piecewise([t < 0, 0],[t > 0, 1]):
(I assume that you're aware that you've left 0
undefined). Then you should be able to evaluate:
T := 1:
plot(u0(t-T/2))
Because u0
is now a function, your first form using the evalAt
operator, |
, must be altered to:
T := 1:
plot(u0(t)|t=t-T/2)
这篇关于使用更多的“自然"字样在Matlab MuPAD中操作分段步进函数的形式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!