Unable to perform assignment because the left and right sides have a different number of elements.
1 次查看(过去 30 天)
显示 更早的评论
I'm getting the error in the title and not sure how to fix it. My code is below:
%% Analytical Solution
% Plot the theoretical 'x' and 'y' displacments of projectile to compare to
% finite difference method.
for i = 1:Niter %(From 1 to total number of iterations)
tSim(i) = (i-1)*dt;
tNow(i) = tSim(i);
Ax(i) = vx0*tNow;
Ay(i) = (-0.5*g*(tNow)^2) + (vy0*tNow) + y0;
end
Thankyou
0 个评论
回答(1 个)
Rik
2020-5-23
tNow is a vector, so you can't store it in a scalar, which is what you are trying to do. You probably want to replace every instance of tNow with tNow(i), or replace the entire loop with array operations.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!