function eulers_for_mv a = .5 ;t = linspace(0,2) ;dt = t(2) - t(1) ;x = zeros(1,length(t));v = zeros(1,length(t));for i=1:length(t)-1 v(i+1) = v(i) + dt*a x(i+1) = x(i) + dt*v(i) ;endoriginal_eq = @(t) [x(1) + v(1)*t +(1/2)*a*t.^2] ;
original_eq(t) —> returns to me a 1×200 matrix because I left some room between t and 1/2 it shouldnt matter no?? if I take this away writing …t+(1/2) … it`ll give me the correct 1×100 matrix. why??
Best Answer