Problem with function @(t) [ (1/2)*a*t.^2]
Show older comments
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) ;
end
original_eq = @(t) [x(1) + v(1)*t +(1/2)*a*t.^2] ;
original_eq(t) ---> returns to me a 1x200 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 1x100 matrix. why??
Accepted Answer
More Answers (0)
Categories
Find more on Assembly 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!