带矢量极限的四边形 [英] quad with vector limit
本文介绍了带矢量极限的四边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用Quad作为限制列表,没有for循环.作为一个基本示例
I want to use quad for a list of limits without a for loop. As a basic example
T=[1 2 3];
f=@(x)x.^2
quad(0,T(1),f)
计算我需要的东西,但我想将quad(0,T(1),f)quad(0,T(2),f)quad(0,T(3),f)保存为向量.可能这是基本的事情,但是我找不到任何解决方案. 感谢您的帮助,
Calculate what I need, but I want to save quad(0,T(1),f) quad(0,T(2),f) quad(0,T(3),f) as a vector. Probably, it is a basic thing but I couldn't find any solution. I'm thankful for any help,
推荐答案
使用arrayfun
:
T=[1 2 3];
f=@(x)x.^2
Q = arrayfun(@(x) quad(f,0,x), T);
*请注意,您的帖子中quad
的参数的顺序不正确.
*Note that your post has the arguments to quad
in an incorrect order.
这篇关于带矢量极限的四边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文