[Scilab-users] Problem using convol() function in scilab

Shantanu Dutta shantanudutta1994 at gmail.com
Mon Apr 14 14:27:59 CEST 2014


Hello everyone!
I want to find convolution of two functions using scilab. I've seen a book
a Matlab solution which I modified to run in scilab.
My code is as follows(Numbers at begining are line no.s):

1. t1=-10:.1:0;t1=t1';
2. g1=-2*exp(2*t1);
3. t2=0:.1:10;t2=t2';
4. g2=2*exp(-t2);
5. t=[t1;t2];g=[g1;g2];
6. f=[zeros(size(g1));ones(size(g2))];
7. c=0.1*convol(f,g);
8. t=-20:.1:5;t=t';
9. plot(t,c(1:length(t)))

After writing line #7 I'm getting following error:
    --error 21
    Invalid index.
    at line      26 of function convol called by :
    convol(f,g)

What is wrong and how should I modify the code to get rid of this error.
I am new to Scilab, so it will be very helpful if please the solution is
explained.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140414/8d27d52a/attachment.htm>


More information about the users mailing list