# Re: [Scilab-users] Problems with Scilab routine "conv"

```Le 03/02/2023 à 21:25, Samuel Gougeon a écrit :
Le 03/02/2023 à 20:57, Samuel Gougeon a écrit :
.../...
Here is a draft proposal:
1) build the (let's say row) vector A = (dPHI/dt) of sampled data at
sampled values t
2) build the row vector B = f(-t) of sample data at t values
3) build the matrix C of (padded) A and the matrix D of (shiffted and
padded) D = B(T-t), with T as multiples of the dt step
Each row of C and D corresponds to a T value.
4) compute E = (C .* D)*dt  when dt is the time step.
5) Set to zero all elements on (#) and above the diagonal of E.
That's to cancel elements with t>T, to code the upper bound T of
the integral.
5) sum E along rows  (the actual integration. You can refine with a
trapeze method).```
```
and that's it: the resulting column vector is your F(T).

As you know the formal expressions of f() and of phi(t), the other way is to
use intg() in a for loop over T,

m = 2;         // Weibull modulus in mechanism  #1
k = 1E-7;      // corrosion rate(s-1) in mechanism  #1
function  r = pseudoconv(t, T)
r = 3600*m*k*((k*t)^(m-1)) * exp(-((k*t)^m)) * (1 - exp((T+t)/3E5));
endfunction
n = 500;
dT = 5;
F = zeros(1, n);
T = (0:(n-1))*dT;
for i = 1:n
F(i) = intg(0, T(i), pseudoconv);

Sorry:

F(i) = intg(0, T(i), list(pseudoconv, T(i)));

instead. That's the point preventing to use conv()!

end

This email and any attachments are intended solely for the use of the
individual or entity to whom it is addressed and may be confidential and/or
privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

and all attachments,

(iii) Dassault Systèmes does not accept or assume any liability or
responsibility for any use of or reliance on this email.

Please be informed that your personal data are processed according to our data
privacy policy as described on our website. Should you have any questions
```_______________________________________________