How to do Numerical Integration of excel data using gauss quadrant?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello all,
I am trying to do a numerical integration of a excel data using gauss quadrant method. I have a function Q = f(Y) which is Q = A*Y, Whre Y is the data from excel at different X positions. I have tried using gauss_quad function. But I am getting an error in it. How can i get the integral value at every location along with a curve of the integral data? Please kindly help me.
My code:
function [I]=Gauss_quad(fstr,a,b)
if nargin<1,
help Gauss.m;
v = xlsread('flow.xlsx','B:B');
r = 0.0685;
A = pi*r^2;
fstr='A*Y';
a=0.01; b=1.5;
end
f=vectorize(inline(fstr,0));
% Seven-point integration scheme so zeta_1 to zeta_7
zeta=[-0.9491079123; -0.7415311855; -0.4058451513; 0.0;
0.4058451513; 0.7415311855; 0.9491079123];
% Weighting coefficients
w=[0.1294849661; 0.2797053914; 0.3818300505; 0.4179591836;
0.3818300505; 0.2797053914; 0.1294849661];
% Index for the seven points
Index=1:7;
% Gauss Integration
I=(b-a)/2*sum(w(Index).*f((b-a).*(zeta(Index)+1)/2+a));
% Display the result
disp(' '); disp(strcat('The integral = ', num2str(I)));
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Numerical Integration and Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!