Integral calculation using matlab
3 次查看(过去 30 天)
显示 更早的评论
Hello i wish to calculate the following integral
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/341284/image.png)
My difficulty stems from the absolute value which is "outside" of the integral with respect to θ
0 个评论
采纳的回答
Bruno Luong
2020-8-4
编辑:Bruno Luong
2020-8-4
Feel free to change these hyper-parameters
n = 3
k = 2*pi*rand()
integral(@(phi) arrayfun(@(phi) abs(integral(@(theta) exp(1i*k*cos(theta-phi)).*cos(n*theta), 0, 2*pi)).^2, phi), 0, 2*pi)
4 个评论
更多回答(1 个)
Matt J
2020-8-4
编辑:Matt J
2020-8-4
My difficulty stems from the absolute value which is "outside" of the integral
Why is this a difficulty? Because it prevents you from using integral2()? Just apply integral() twice instead.
5 个评论
Steven Lord
2020-8-4
Write a function to compute the inner integral. This function should accept phi. One wrinkle here is that since the outer integral call is going to pass a vector of values into it as phi, your inner integral call will need to say that the function is ArrayValued.
Write a function that takes the absolute value of that inner integral function.
Write a function to compute the outer integral of the absolute value function.
If you try this and it doesn't work, show us the code you wrote and we may be able to offer some guidance.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!