Intergation problem

I am trying to solve the intergal of e^(-1/x)and plot it.
The entire function is as shown below,
Thanks in Anticipation
Shashi

Risposte (1)

Andrei Bobrov
Andrei Bobrov il 8 Ott 2011

0 voti

C = 1;
a = 0;
b = 1;
quad(@(x)exp(-C./x),a,b)
about plot
fun = @(x)arrayfun(@(x)quad(@(x)exp(-C./x),0,x),x);
plot(0:.1:20,fun(0:.1:20))

2 Commenti

Shashishekar
Shashishekar il 8 Ott 2011
Hi,
@andrei, thank you. But I have a problem. when i check the code for cos(x), it works fine but it seems to be not giving convincing plot when i use sin(x) function
Below is the modified code,
C = 1;
a = 0;
b = pi;
quad(@(x) sin(x),a,b)
fun = @(x)arrayfun(@(x)quad(@(x)sin(x),0,x),x);
plot(0:.1:20,fun(0:.1:20))
<http://imageshack.us/photo/my-images/835/sinxx.png/>
Andrei Bobrov
Andrei Bobrov il 8 Ott 2011
funcos = @(x)arrayfun(@(x)quad(@(x)sin(x+pi),pi/2,x),x);

Accedi per commentare.

Richiesto:

il 8 Ott 2011

Community Treasure Hunt

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

Start Hunting!

Translated by