Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions matlab/+mr/makeExtendedTrapezoid.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@
if any(abs(round(opt.times/system.gradRasterTime)*system.gradRasterTime-opt.times)>1e-8) % 10ns is an acceptable rounding error
error('All time points must be on a gradient raster or "convert2arbitrary" option must be used.');
end
% check slew rate and gradient amplitude against the active limits
% the convert2arbitrary branch above gets these checks via mr.makeArbitraryGrad
slew = (opt.amplitudes(2:end)-opt.amplitudes(1:end-1)) ./ (opt.times(2:end)-opt.times(1:end-1));
if ~isempty(slew) && max(abs(slew))>maxSlew
error('Slew rate violation (%.0f%%)',max(abs(slew))/maxSlew*100);
end
if max(abs(opt.amplitudes))>maxGrad
error('Gradient amplitude violation (%.0f%%)',max(abs(opt.amplitudes))/maxGrad*100);
end
%
grad.type = 'grad';
grad.channel = opt.channel;
Expand Down
Loading