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

Réponses (1)

Andrei Bobrov
Andrei Bobrov le 8 Oct 2011

0 votes

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 commentaires

Shashishekar
Shashishekar le 8 Oct 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 le 8 Oct 2011
funcos = @(x)arrayfun(@(x)quad(@(x)sin(x+pi),pi/2,x),x);

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by