Function requires more inputs

7 ビュー (過去 30 日間)
Jayden Riley
Jayden Riley 2020 年 10 月 26 日
回答済み: Adam Danz 2020 年 10 月 26 日
I am trying to code a Gaussian Quadrature funtion. My function as of now is...
function I = GQ5_Riley(fun,a,b)
N = 5;
w = [0.5688888888888889 0.4786286704993665 0.4786286704993665 0.2369268850561891 0.2369268850561891];
x = [0.0000000000000000 -0.5384693101056831 0.5384693101056831 -0.9061798459386640 0.9061798459386640];
I = ((b-a)/2)*sum(w.(1:1:N))*fun(((b-a).*x+b+a)/2);
end
I need MatLab to sum the w values one at a time until it reaches the last and 5th w value. as well as multiply the b-a by the 5 x values.
Any help would be appreciated.

回答 (1 件)

Adam Danz
Adam Danz 2020 年 10 月 26 日
"I need MatLab to sum the w values one at a time until it reaches the last and 5th w value"
"...as well as multiply the b-a by the 5 x values"
This isn't clear to me but it sounds like you want to do element-wise multiplication.

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by