Conv function gives unexpected error
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Au.
el 11 de Abr. de 2022
Respondida: Matt J
el 11 de Abr. de 2022
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 comentarios
Stephen23
el 11 de Abr. de 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')
Respuesta aceptada
Matt J
el 11 de Abr. de 2022
Clear the variable called conv from your workspace
clear conv
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!