绘制内置MATLAB函数的符号导数

时间:2017-05-09 17:08:38

标签: matlab

我正在尝试计算通风函数的二阶导数。只有它的一阶导数是MATLAB中的预定义函数(airy(1,x)

有没有办法计算它的符号衍生物?没有诉诸有限的差异等等

我试过这个

syms x
aiprime = @(x) airy(1,x);
aisecond = diff(airy(1,x));

plot(-10:0.01:10,aiprime,aisecond)

但没有工作。

Error using plot
Invalid second data argument

1 个答案:

答案 0 :(得分:0)

问题是你的情节陈述。您指定了所需的x - 数据,但未在以下几点评估您的功能:

syms x
aiprime(x) = airy(1,x); % I would define it as a symbolic function instead of a function handle, although it works too.
aisecond(x) = diff(airy(1,x)); % Define as a function, to be able to evaluate the function easily

xs = -10:0.01:10; % define your desired x points
plot(xs,aiprime(xs),xs, aisecond(xs)) % evaluate your functions and plot data

enter image description here