使用Matlab符号工具箱导出dirac delta函数 [英] Deriving dirac delta function using Matlab symbolic toolbox

查看:287
本文介绍了使用Matlab符号工具箱导出dirac delta函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Matlab的新手.我不明白如何派生狄拉克三角洲函数,然后使用符号工具箱对其进行移位.

i'm new in matlab. I didn't understand how to derive a dirac delta function and then shift it using symbolic toolbox.

syms t
x = dirac(t)

为什么我不能使用例如ezplot(x,[-10,10])看到狄拉克三角洲函数?

why can't i see the dirac delta function using ezplot(x,[-10,10]) for example?

推荐答案

正如其他人所指出的, Dirac增量函数不是真正的函数,而是通用函数. dirac的帮助表明:

As others have noted, the Dirac delta function is not a true function, but a generalized function. The help for dirac indicates this:

狄拉克(X)并不是严格意义上的函数,而是
int(dirac(x-a)* f(x),-inf,inf)= f(a)和
的分布 diff(heaviside(x),x)= dirac(x).

dirac(X) is not a function in the strict sense, but rather a
distribution with int(dirac(x-a)*f(x),-inf,inf) = f(a) and
diff(heaviside(x),x) = dirac(x).

严格来说,Matlab无法以正常方式绘制Dirac delta函数,因为它的一部分延伸到了无穷大.但是,如果要进行可视化,有许多解决方法.一种简单的方法是使用 stem 绘图函数和>运算符可将一个Inf值转换为有限值.这样会产生单位脉冲函数(或克罗内克三角洲):

Strictly speaking, it's impossible for Matlab to plot the Dirac delta function in the normal way because part of it extends to infinity. However, there are numerous workarounds if you want a visualization. A simple one is to use the stem plot function and the > operator to convert the one Inf value to something finite. This produces a unit impulse function (or Kronecker delta):

t = -10:10;
x = dirac(t) > 0;
stem(t,x)

如果tx已经作为符号变量/表达式而不是数字变量存在,则可以使用subs:

If t and x already exist as symbolic variables/expressions rather than numeric ones you can use subs:

syms t
x = dirac(t);
t2 = -10:10;
x2 = subs(x,t,t2)>0;
stem(t2, x2)

如果您想要一些看起来不同的东西,则可以编写自己的绘图例程.使用ezplot不太可能起作用,因为它不能提供太多控制.

You can write your own plot routine if you want something that looks different. Using ezplot is not likely to work as it doesn't offer as much control.

这篇关于使用Matlab符号工具箱导出dirac delta函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆