Problem solving DE neural network

1 view (last 30 days)
Melda Harlova
Melda Harlova on 8 Jan 2020
Hi,
I need a help with this solution expecially with the last line mesh(x1,x2,y). Error: Unrecognized function or variable 'x1' and 'x2'
clear all
load zad2.mat
k=1; n=length(x);
for i=1:n
for j=1:n
z(i,j)=u(i,j);
p(1,k)=x(i);
p(2,k)=y(j);
t(k)=z(i,j);
k=k+1;
end
end
figure(1), mesh(x,y,z);
net=newff(minmax(p),[3,1],{'tansig','purelin'},'trainlm');
net.trainParam.epochs=100;
%net.trainParam.goal=0.001;
net=train(net,p,t);
for i=1:n
for j=1:n
y(i,j)=sim(net,[x(i);y(j)]);
end
end
figure(2),mesh(x1,x2,y)
where file zad2.mat is generated here with this code:
clear all
n=25; k=50; h=1/n; N=n+1;
y = 0:h:1;
x=0:h:1;
for i = 1 : N
u(i,1)=0;
u(i,N)=x(i);
end
for j = 1 : N
u(1,j)=exp(y(j))+(1-exp(1))*(y(j)^2)-1;
u(N,j)=y(j);
end
for m=1:k
for i=2:n
for j=2:n
u(i,j)=(u(i-1,j)+u(i+1,j)+u(i,j-1)+u(i,j+1))/4;
end
end
end
figure(1), mesh(x,y,u)
figure(2), contour(u)
save zad2.mat x y u

Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!