Mercurial > repos > public > sbplib
comparison alignedTimestep.m @ 12:c71095442c57
Added function to calculate an aligned timestep.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 22 Sep 2015 08:35:57 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
11:0c166d195f58 | 12:c71095442c57 |
---|---|
1 % Calcualtes the largest timestep smaller than k_max that gives an integer | |
2 % number of timesteps to time T. | |
3 % k_max -- largest allowable timestep | |
4 % T -- time to align with | |
5 % | |
6 % Returns: | |
7 % k -- calculated timestep | |
8 % N -- number to of timestep to reach T | |
9 function [k, N] = alignedTimestep(k_max, T) | |
10 N = ceil(T/k_max); | |
11 k = T/N; | |
12 end |