Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我以这种方式使用了 quad 函数:
F = @(x)1./(x.^3-2*x-5); Q = quad(F,0,2);
但现在我的 F 函数改为:
F = @(x,y) y./(x.^3-2*x-5);
我在其他循环中使用 Quad,所以每次迭代都有 y 值。
我试图以这种方式使用 Quad:
Q = quad(F(y),0,2);
但我得到一个参数不足的错误。我能做些什么?
您可以使用仅定义的匿名函数x来评估F(x,y)何时y已知
x
F(x,y)
y
Q = quad(@(x) F(x,y), 0, 2)