Having trouble trying to integrate.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Below is my code but I have no idea why it will not run.
I just want to integrate the function (x*.515siin(x)) from 0 to 2.794
fx = @(x) x*(103./200)*sin(x));
q= integral(fx,0,2.794)
0 Kommentare
Antworten (1)
Torsten
am 18 Apr. 2022
fx = @(x) x.*103./200.*sin(x);
q= integral(fx,0,2.794)
2 Kommentare
Torsten
am 18 Apr. 2022
"integral" passes vectors for x to your function, not only scalar values. Therefore, you must use elementwise multiplication and division in your function definition:
fx = @(x) x.*103./200.*sin(x);
q= integral(fx,0,2.794)
mu= @(x) (x-q).^2.*fx(x);
M= integral(mu,0,2.794)
%Std of x
x_sq=sqrt(M)
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!