【问题标题】:symbolic calculus in MATLABMATLAB中的符号演算
【发布时间】:2015-08-21 10:16:36
【问题描述】:

我找不到在 MATLAB 中定义这个方程的方法:

'subs' n 和 m 与向量 Delta 和 L 的长度有关(我已经阅读了一些关于 'symprod' 和 'symsum' 的帮助参考,但我认为它们在这种情况下不合适)。

为了找到例如符号导数或仅解决方案(给定参数),处理这类方程的最佳方法是什么?

【问题讨论】:

  • delta 一个长度为N 的数值向量吗?函数L 是如何定义的? tt_{m-1}t_{m} 有什么关系?

标签: matlab symbolic-math


【解决方案1】:

为了定义这样一个符号函数,我迭代地构建了它。由于从您的公式中我不清楚,我假设delta 是大小为N 的数值向量。我也省略了函数L,但你应该明白了:

syms t;

% define a demo function and random inputs
F = symfun(2*t, t);
% length of delta
N=5;
delta = randi(10,N,1);


% build function P(t) iteratively

% build the sum
s = 0;
for n=1:N
    % build the product
    p = 1;
    for m=1:n
        p = p*(1+delta(m)*(F));
    end
    s = s + delta(n)/p;
end

% build the final function
P = 1+(F(0) + F)*s;

然后您可以评估或区分P(t)

P(1.234)
dP = diff(P)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多