how to add timestep iteration and show all iteration in plot
11 次查看(过去 30 天)
显示 更早的评论
Alteration
0 个评论
采纳的回答
Benjamin Thompson
2022-2-8
You can use a for loop, using your t0, dt, and tf variables in a vector notation to define the values of the time variable t:
for t = t0:dt:tf
your code...
end
1 个评论
Benjamin Thompson
2022-2-10
If this question has been answered, please mark it accepted. Users with a higher acceptance rate will get faster and more effective responses for future answers.
更多回答(1 个)
Arif Hoq
2022-2-8
time = [4 50] ;
points = [20 100] ;
% interpolation
step_count = time(1):0.1:time(2) ; % timestep 0.1
expected_points = interp1(time,points,step_count) ;
% plot
plot(time,points,'*r',step_count,expected_points,'-g')
ylim([0 110])
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!