I want to plot y vs. B

1 view (last 30 days)
reem123
reem123 on 4 Mar 2023
Commented: reem123 on 6 Mar 2023

Accepted Answer

Torsten
Torsten on 4 Mar 2023
Moved: Torsten on 4 Mar 2023
B >= 1 ?
B = 1:0.1:10;
y = arrayfun(@(B) 2/sqrt(pi)*integral(@(x)x.^0.5./(B*exp(x)-1),0,Inf),B);
plot(B,y)
grid on
  3 Comments
Star Strider
Star Strider on 4 Mar 2023
Since ‘B’ is not an integration limit, this would also work —
B = 1:0.1:10;
y = 2/sqrt(pi)*integral(@(x)x.^0.5./(B*exp(x)-1),0,Inf, 'ArrayValued',1)
y = 1×91
2.6124 1.6562 1.3616 1.1727 1.0359 0.9304 0.8460 0.7764 0.7180 0.6680 0.6248 0.5870 0.5537 0.5240 0.4974 0.4734 0.4517 0.4319 0.4138 0.3971 0.3818 0.3676 0.3544 0.3422 0.3308 0.3201 0.3101 0.3007 0.2919 0.2836
Otherwise the arrayfun call would be required.
.
reem123
reem123 on 6 Mar 2023
Thank you

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!