hello how do I write this function without getting an error saying "variable K has an incorrect value".
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
my code is: And so far only the (K) is wrong.
N = 1000;
a= 0;
b= pi;
h = (b-a)/N;
x=a:h:b;
f = x.^2.*sin(x);
F = sum(f*h );
a= 1;
b= 2;
h = (b-a)/N;
x=a:h:b;
g =(x.^3.2 + 2.*x.^2.22 +x + 21) ;
G = sum(g*h) ;
a=-3 ;
b= 3;
h = (b-a)/N;
x=a:h:b;
k =abs(x).*exp(-x).^2 ;
K = sum(k*h);
0 Kommentare
Antworten (2)
KSSV
am 27 Mai 2020
a=-3 ;
b= 3;
h = (b-a)/N;
x=a:h:b;
k =abs(x).*exp(-x.^2) ;
K = sum(k*h);
10 Kommentare
Image Analyst
am 27 Mai 2020
What is "the above technique"?
Try using trapz() instead of sum.
7 Kommentare
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differentiation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!