Conv function gives unexpected error
2 views (last 30 days)
Show older comments
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 Comments
Stephen23
on 11 Apr 2022
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')
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!