Numerical integration of array

1 次查看(过去 30 天)
Rita
Rita 2013-5-6
Hej, I am using Matlab in order to integrate a lengthy integral:
Int=4*(P_mean*P_mean')*(PHI(:,1)*PHI(:,1)').*C.*(sqrt(Su(i,:)'*Su(i,:))./(meanwind(i,:)'*meanwind(i,:)));
where P_mean is an nx1 vector PHI(:,1)is an nx1 vector Su(i,:)is an nx1 vector meanwind(i,:)is an nx1 vector So, Int is an nxn array. I want to compute the double integral of the array. Can you please advise me on the use of the trapezoidal rule in this case?Is that my only option?
Thank you for your help,
Best regards,
Rita
  2 个评论
Roger Stafford
Roger Stafford 2013-5-6
Don't you mean Su(i,:) and meanwind(i,:) are 1xn vectors? Three other important questions: a) Is C a scalar or an n x n array, b) are all elements of Su of like sign, and c) do you mean to have "*" or ".*" as the operator between (P_mean*P_mean') and (PHI(:,1)*PHI(:,1)')?
Roger Stafford
Roger Stafford 2013-5-6
The reason for my question about C is that if C is merely a scalar, I believe your integrand is "separable" and its integral can be expressed as the product of two single integrals, each using 'trapz'. If C is an n x n array, then it would probably be necessary to use a 'trapz' call within another one to evaluate the double integral. It would be convenient to know which is true before giving you specific advice.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by