I am getting the error : "Attempted to access x(1.01); index must be a positive integer or logical."
Help would be appreciated please 🙂
clc, clear all func = @(t,x) -t*x;
t = 0; x = 1; h = 0.01; N = 10 tarrays = zeros(1,N); xarrays = zeros(1,N);
for i = 1:h:N
x(i+1) = x(i) + h.*func(t(i),x(i)); tarrays = t(i) xarrays = x(i+1)end
Best Answer