Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Problem with a program concerning composite trapezoid rule

3 ビュー (過去 30 日間)
Drake
Drake 2013 年 10 月 22 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
In this program I'm using the composite trapezoid rule on the function in my program. I've used the same program with different functions and haven't had issues till I tried it with this function. (Not sure if I'm using the dots correctly in my function) It says I have an error with line S=f(a); Here is code:
f = @(x) -exp(-(ln(t).^2))*(1./t);
a = 1;
b = 0;
n= 10000;
format long
h = (b-a)/n;
S = f(a);
i=1:1:n-1;
x=a+h*i;
y=f(x);
S=S+2*sum(y);
S=S+f(b);
F=h*S/2

回答 (0 件)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by