Conv function gives unexpected error
2 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone,
I am again raising the convolution topic - sorry!
I need to convolute a gaussian, a heaviside and an exponential decay function.
Just using, for example, conv(gaussian,hea,'same') gives me always the following error:
'Subscript indices must either be real positive integers or logicals.'
this is the code i am using:
t=-5:0.1:10;
gaussian=exp(-((t-0.15)/0.164).^2);
hea=(0.2*heaviside(t-0.15));
exp_decay=(exp(-((t-0.15)/0.300)));
func=conv(hea,gaussian,'same');
I found a way arround using the erf fuction, but i do not understand what is the problem... and it would be really useful to be able to use the conv function.
Thank you so much for your answer!
Audrey
2 件のコメント
Stephen23
2022 年 4 月 11 日
Your code works without error:
t = -5:0.1:10;
gaussian = exp(-((t-0.15)/0.164).^2);
hea = (0.2*heaviside(t-0.15));
exp_decay = (exp(-((t-0.15)/0.300)));
func = conv(hea,gaussian,'same')
採用された回答
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!