Help with coding (integral)
Ältere Kommentare anzeigen
How can i solve this integral ((1/5*x)+1)*sqrt(1+exp(-2x)) by using Simpsons method? The upper limit is 1 and the lower limit is 0. I know how to solve it, but i keep getting these errors. It says "Invalid expression. Check for missin multiplication operator...".
3 Kommentare
David Hill
am 10 Nov. 2020
What have you done? Your equation should be:
eqn=@(x)((1/5*x)+1).*sqrt(1+exp(-2*x));
leyla ahmed
am 10 Nov. 2020
leyla ahmed
am 10 Nov. 2020
Akzeptierte Antwort
Weitere Antworten (1)
David Hill
am 10 Nov. 2020
a = 0; b = 1; n = 20;
h = (b-a)/n;
x = linspace(a,b,n+1);
f = ((1/5*x)+1).*sqrt(1+exp(-2*x));
F = h/3*(f(1)+2*sum(f(2:2:end-1))+4*sum(f(1:2:end-1))+f(end));
Kategorien
Mehr zu Numerical Integration and Differential Equations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!