Cannot make a simple integral on matlab
显示 更早的评论
First I've tried this:
Fm=1/(2*pi)*(int(220*2^0.5,0,pi)+int(220*2^0.5,pi,2*pi))
Returns this: Undefined function or method 'int' for input arguments of type 'double'.
Then, I've tried this:
Fm=1/(2*pi)*(quadgk(220*2^0.5,0,pi)+quadgk(220*2^0.5,pi,2*pi))
Which returns this: First input argument must be a function handle.
And This:
Fm=1/(2*pi)*(integral(220*2^0.5,0,pi)+integral(220*2^0.5,pi,2*pi))
Resulting on this: Undefined function or method 'integral' for input arguments of type 'double'
What about this:
1/(2*pi)*(integral(220*2^0.5,0,pi)+integral(220*2^0.5,pi,2*pi))
Hmm... NO!
Maybe this:
integral(220*2^0.5,0,pi), or this: int(220*2^0.5,0,pi)
No! Says Matlab r2010a... I don't like you, little user.
But seems like it works for 2013 version only
Don't know what to do.
1 个评论
Walter Roberson
2013-8-12
Are you really integrating a constant value (220*sqrt(2)) over the range pi to 2*pi ? You know that the integral of a constant over a definite integral is just the constant times the width of the interval ?
采纳的回答
更多回答(1 个)
Sean de Wolski
2013-8-12
You need to convert the doubles to syms:
Fm=1/(2*pi)*(int(sym('220*2^0.5'),0,pi)+int(sym('220*2^0.5'),pi,2*pi))
类别
在 帮助中心 和 File Exchange 中查找有关 Common Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!