Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

I am getting error in this code?

1 visualizzazione (ultimi 30 giorni)
rajasekhar reddy ogirala
rajasekhar reddy ogirala il 14 Feb 2014
Chiuso: MATLAB Answer Bot il 20 Ago 2021
f=@(x)cos(x)/x q(x)=integral(f,0,10)
i am getting error in evaluating that statements in command window
sorry guys i am very new to MATLAB.
Thanks for ur help

Risposte (1)

Mischa Kim
Mischa Kim il 14 Feb 2014
Modificato: Mischa Kim il 14 Feb 2014
Rajasekhar, use
f = @(x) cos(x)./x;
q = integral(f,0.1,10)
There is a problem though with f approaching inf as you approach x=0. So you can get close but not all the way.
  2 Commenti
Roger Stafford
Roger Stafford il 14 Feb 2014
Actually that integral is divergent at the lower limit of zero. As the lower limit, a, approaches zero, the integral approaches plus infinity in a similar way to -log(a).

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by