Integration limit is an array

조회 수: 6 (최근 30일)
Athira T Das
Athira T Das 2022년 12월 22일
댓글: VBBV 2022년 12월 22일
syms x
tau=35*10^-15;
f=tau.*exp(-x.^(2));
t=linspace(-300*10^-15,300*10^-15,500);
fun=matlabFunction(f,'Vars',x);
z=integral(fun,-Inf,(t/tau),'ArrayValued',true)
Error using integral
Limits of integration must be double or single scalars.

채택된 답변

VBBV
VBBV 2022년 12월 22일
syms x
tau=35*10^-15;
f=tau.*exp(-x.^(2));
t=linspace(-300*10^-15,300*10^-15,500);
fun=matlabFunction(f,'Vars',x)
fun = function_handle with value:
@(x)exp(-x.^2).*3.5e-14
for k = 1:length(t)
z(k)=integral(fun,-Inf,(t(k)/tau),'ArrayValued',true);
end
z
z = 1×500
1.0e-13 * 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
plot(t,z)
  댓글 수: 1
VBBV
VBBV 2022년 12월 22일
As mentioned in error, use scalar inputs to function integral

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by