Я приложил все усилия, чтобы написать этот код, но он не работает, может кто-нибудь помочь мне, пожалуйста
Я хочу построить функцию uVLL, это приблизительное решение pde
for i=1:N+2
uVLL(i,1)= g(a+i.*h);
end
for i=1:N+1
V(i,1) = g(a+(i+0.5)*h);
end
for i=2:N+1
uVLL(i,2)= uVLL(i,1)- cte*(V(i,1) - V(i-1,1));
end
for j=3:M-1
for i=2:N
W(i,1) = V(i,j-1); % I want to keep the values of the vector V(i,j-1) and change the next
V(i,j-1)= uVLL(i,j-1) + (W(i,1) - W(i-1,1))/h; % change the values of the vector V(i,j-1)
end
V(1,j-1)=V(2,j-1);
V(N+1,j-1)=V(N,j-1);
for i=2:N+1
uVLL(i,j)= uVLL(i,j-1)- cte*( V(i,j-1)- V(i-1,j-1));
end
uVLL(1,j)= uVLL(2,j);
uVLL(N+2,j)= uVLL(N,j);
end
ошибка, которую я получаю
Index in position 2 exceeds array
bounds (must not exceed 1).
Error in VLL_CdtN (line 23)
W(i,1) = V(i,j-1);
Error in Appel_MDF (line 24)
uVLL=VLL_CdtN(g,N,M,a,b,c,d);