[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
slow integration
From: |
Patrick Dupre |
Subject: |
slow integration |
Date: |
Wed, 11 Apr 2018 14:09:18 +0200 |
Hello,
I guess that I am doing something not very good because it is slow.
function y = Lor (x, amp, x0, g)
y = amp ./ ((x - x0).**2 .+ g .* g) ;
endfunction
function y = Sat (x, t, shift, wD, g, s)
tt = t ./ wD ;
tmp = Lor ((x .- t), 1, -shift, g) ;
tmp += Lor ((x .+ t), 1, -shift, g) ;
tmp += Lor ((x .- t), 1, shift, g) ;
tmp += Lor ((x .+ t), 1, shift, g) ;
y = exp (-tt .* tt) .* tmp ./ (1 .+ tmp .* s) ;
endfunction
function y = Int_Sat (x, Shift, wD, g, s)
y = quad (@(t) Sat (x, t, Shift, wD, g, s), 0, 15) ;
endfunction
N=101;
x_min = -10
x_max = 10
step = (x_max - x_min) / (N - 1)
for i = 0:N
ii = i + 1 ;
xx (ii) = x_min + i * step;
yy2 (ii) = Int_Sat (xx (ii), 2, 5, 0.0005, 0.01) ;
endfor
Some ideas?
Thank.
===========================================================================
Patrick DUPRÉ | | email: address@hidden
Laboratoire de Physico-Chimie de l'Atmosphère | |
Université du Littoral-Côte d'Opale | |
Tel. (33)-(0)3 28 23 76 12 | | Fax: 03 28 65 82 44
189A, avenue Maurice Schumann | | 59140 Dunkerque, France
===========================================================================
- slow integration,
Patrick Dupre <=