numerical integration in matlab

조회 수: 1 (최근 30일)
Raj Patel
Raj Patel 2020년 10월 27일
댓글: Raj Patel 2020년 10월 27일
Hello everyone,
I am trying to first numerically integrate a function and then plot the output of the integral. However, I have a variable T which is in the range (1:1000). I am not sure how to use a loop in integral and then plot values for all T with the corresponding value of integral. The MATLAB code is:
Hello everyone,
I am trying to first numerically integrate a function and then plot the output of the integral. However, I have a variable T in the integral which is in the range (1:1000). I am not sure how to use a loop in integral and then plot values for all T with the corresponding value of integral. The MATLAB code is:
kb = 1.38 .* 10.^-23;
h = 1.05 .* 10.^-34;
wd = 6.94 .* 10.^13;
vs = 6084;
B1 = 2.7 .* 10.^-19;
B2 = 170;
A1 = 2 .* 10.^-45;
D = 0.004;
c = (h.^2 .* D) ./ (2 .* pi * pi * vs * kb .* T .* T);
T = 1:1000;
fun = @(x) ((x.^4 .* exp((h.*x) ./ (kb .* T))) ./ (((exp((h.*x) ./ (kb .* T))-1).^2) .* ((D.*B1 .* x.^2 .* T .* exp(-B2/T)) + (D.*A1 .* x.^4) + vs)));
K = c .* integral(fun,0,wd)
plot(T, K)
Thanks in advance,
Raj Patel.
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 10월 27일
K = c .* integral(fun,0,wd, 'arrayvalued', true);
Raj Patel
Raj Patel 2020년 10월 27일
Thanks Walter.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by