Find integral of a function where upper limit changes inside the function

5 visualizaciones (últimos 30 días)
I want to calculate integral of in equation 12 in image.
When t=30,D=250, x=40., I have found it with following code
t = 30
a=@(g) ((t-g).^(-1.5)).*exp(-4./(t-g));
b=integral(a,0,t);
h=282.09.*b
But I am unable to do it when t is a vector say t = 1:30, it means I want to find out h at every t from 1 to 30.

Respuesta aceptada

Birdman
Birdman el 6 de Nov. de 2017
Editada: Birdman el 6 de Nov. de 2017
for t = 1:1:30
a=@(g) ((t-g).^(-1.5)).*exp(-4./(t-g));
b=integral(a,0,t);
h(t)=282.09.*b
end
  12 comentarios
Atr cheema
Atr cheema el 7 de Nov. de 2017
Editada: Atr cheema el 7 de Nov. de 2017
@Torsten may be I am getting nothing at all. How can I come from the graph from your code to the target graph which I mentioned before where I have input sine wave g(t) (black line) and output (yellow line)?
Torsten
Torsten el 7 de Nov. de 2017
Editada: Torsten el 7 de Nov. de 2017
Change
x = 40;
t = 1:30;
g = @(tau) sin(tau);
to
x = 30;
t = linspace(0.05,100,2000);
g = @(tau) sin(tau/2);
in the above code.
Best wishes
Torsten.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by