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!