<div dir="ltr">Hello everyone!<div>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.</div><div>My code is as follows(Numbers at begining are line no.s):</div>
<div><br></div><div>1. t1=-10:.1:0;t1=t1';</div><div>2. g1=-2*exp(2*t1);</div><div>3. t2=0:.1:10;t2=t2';</div><div>4. g2=2*exp(-t2);</div><div>5. t=[t1;t2];g=[g1;g2];</div><div>6. f=[zeros(size(g1));ones(size(g2))];</div>
<div>7. c=0.1*convol(f,g);</div><div>8. t=-20:.1:5;t=t';</div><div>9. plot(t,c(1:length(t)))</div><div><br></div><div>After writing line #7 I'm getting following error:</div><div> --error 21 </div><div><div> Invalid index.</div>
<div> at line 26 of function convol called by : </div><div> convol(f,g)</div></div><div><br></div><div><div>What is wrong and how should I modify the code to get rid of this error.</div><div>I am new to Scilab, so it will be very helpful if please the solution is explained.<br>
</div></div></div>