Bonsoir,

si quelqu'un px m'aider en matlab pr transformer le code ci-dessous!!!?
pour résoudre l'équation: S=exp(-((x[i,j]-2).^2)) + 0.8.*exp(-(y[j,k]+2).^2);


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function toyexample
% show how sigma converges for the simple 1 d case
N=100;
rho=0.4;
alpha=1;
epsilon=0.001;
mu=8 - 16*rand(1); % init mu
sig=100; % initial std dev.
xx=linspace(-8,8,500);
zz=exp(-((xx-2).^2)) + 0.8.*exp(-(xx+2).^2);
while sig>epsilon,
x=mu + sig.*randn(N,1);
S=exp(-((x-2).^2)) + 0.8.*exp(-(x+2).^2);
[S,I]=sort(S);
mu = alpha*mean(x(I((1-rho)*N:N))) + (1-alpha)*mu;
sig= alpha*std(x(I((1-rho)*N:N))) + (1-alpha)*sig;
plot(xx,zz,'b-')
hold on
% yy=exp(-((xx-mu).^2)./(2*sig.^2))./(sqrt(2*pi)*sig);
%length(mu)
h=plot(x(I),S,'rx');
set(h,'MarkerSize',12)
hold off;
axis([-8 8 0 1])
drawnow;
statuspress=waitforbuttonpress;
%pause(1.5)
end