Skip to content

Commit acd2eb3

Browse files
Add docs to Problem (#129)
* Add docs to Problem * Apply suggestions from code review * Put Problem example output in correct position * Problem doc fixes * Add RHS.odeset example
1 parent 3d3ee50 commit acd2eb3

File tree

6 files changed

+438
-82
lines changed

6 files changed

+438
-82
lines changed

toolbox/+otp/+utils/+movie/+recorder/FileRecorder.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ function stop(obj)
4343
obj.VideoWriter.close();
4444
end
4545

46-
function h = play(obj)
47-
h = implay(fullfile(obj.VideoWriter.Path, obj.VideoWriter.Filename), obj.VideoWriter.FrameRate);
46+
function play(obj)
47+
implay(fullfile(obj.VideoWriter.Path, obj.VideoWriter.Filename), obj.VideoWriter.FrameRate);
4848
end
4949
end
5050
end

toolbox/+otp/+utils/+movie/+recorder/MemoryRecorder.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ function stop(~)
2929
% Nothing to do
3030
end
3131

32-
function h = play(obj)
33-
h = implay(obj.Mov, obj.FrameRate);
32+
function play(obj)
33+
if exist('implay', 'file')
34+
implay(obj.Mov, obj.FrameRate);
35+
else
36+
movie(obj.Mov, 1, obj.FrameRate);
37+
end
3438
end
3539
end
3640
end

toolbox/+otp/+utils/+movie/+recorder/NullRecorder.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ function stop(~)
2424
% Nothing to do
2525
end
2626

27-
function h = play(~)
28-
h = 'Movie not saved for playback';
29-
error('OTP:movieNotSaved', h);
27+
function play(~)
28+
error('OTP:movieNotSaved', 'Movie not saved for playback');
3029
end
3130
end
3231
end

toolbox/+otp/+utils/+movie/Movie.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
p = inputParser;
1818
p.addParameter('Save', false);
1919
p.addParameter('FrameRate', otp.utils.movie.Movie.DefaultFramerate);
20-
p.addParameter('TargetDuration', [], @(d) d > 0);
20+
p.addParameter('Duration', [], @(d) d > 0);
2121
p.addParameter('Size', [], @(s) length(s) == 2 && all(s > 0));
2222
p.addParameter('Smooth', true, @islogical);
2323
p.parse(varargin{:});
@@ -46,27 +46,27 @@ function record(obj, t, y)
4646
totalSteps = length(t);
4747
[state.numVars, state.totalSteps] = size(y);
4848
if length(t) ~= state.totalSteps
49-
error('OTP:invalidSolution', ...
50-
'Expected y to have %d columns but has %d', ...
51-
length(t), state.totalSteps);
49+
error('OTP:invalidSolution', 'Expected y to have %d columns but has %d', length(t), state.totalSteps);
5250
end
5351

5452
state.t = t;
5553
state.y = y;
5654
state.step = 0;
5755
state.frame = 0;
5856

59-
if isempty(obj.Config.TargetDuration)
57+
if isempty(obj.Config.Duration)
6058
state.totalFrames = totalSteps;
6159
else
62-
state.totalFrames = round(obj.Config.TargetDuration * obj.FrameRate);
60+
state.totalFrames = round(obj.Config.Duration * obj.FrameRate);
6361
end
6462

6563
[t0, tEnd] = bounds(t);
6664

6765
fig = figure;
6866
if ~isempty(obj.Config.Size)
69-
fig.Position = [0; 0; obj.Config.Size(:)];
67+
pos = get(fig, 'position');
68+
pos(3:4) = obj.Config.Size;
69+
set(fig, 'position', pos);
7070
end
7171

7272
obj.init(fig, state);
@@ -97,8 +97,8 @@ function record(obj, t, y)
9797
obj.Recorder.stop();
9898
end
9999

100-
function h = play(obj)
101-
h = obj.Recorder.play();
100+
function play(obj)
101+
obj.Recorder.play();
102102
end
103103
end
104104

0 commit comments

Comments
 (0)