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

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2011년 10월 8일

0 개 추천

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

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

댓글을 달려면 로그인하십시오.

태그

질문:

2011년 10월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by