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 日

0 投票

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 件)

カテゴリ

質問済み:

2022 年 12 月 22 日

コメント済み:

2022 年 12 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by