integral() not working properly?
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am trying to integrate a function, however integral() doesn't seem to give the correct value -
f=@(t) sin(t.^3./3);
y=integral(f, 0, Inf)/pi
Doing symbolic integration
format long
syms x
z=double(int(sin(x^3/3), 0, Inf)/pi)
Doing the same in Wolfram Alpha results in the correct answer, I have attached the image file.
Any particular reason why this is happening?
0 Commenti
Risposte (1)
Chunru
il 15 Lug 2022
Modificato: Chunru
il 15 Lug 2022
% This is an oscillating function. It is difficult for numerical
% integration to converge (automatically compute intervals).
% Sometime, one can adjust Tol parameters and integration interval for luck.
f=@(t) sin(t.^3./3);
%y=integral(f, 0, Inf, 'RelTol', 0, 'AbsTol',1e-8)/pi
y=integral(f, 0, (10000*6*pi).^(1/3), 'RelTol', 0, 'AbsTol',1e-8)/pi
% The symbolic integration is evaluating the formula
format long
syms x
z=double(int(sin(x^3/3), 0, Inf)/pi)
Vedere anche
Categorie
Scopri di più su Number Theory in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!