Calculations/+Plotter/plotCaptureVelocityVsAngle.m

37 lines
1.2 KiB
Matlab

function plotCaptureVelocityVsAngle(OvenObj, MOTObj)
theta = linspace(0, OvenObj.ExitDivergence, 1000);
CaptureVelocity = zeros(length(theta),3);
for i=1:length(theta)
CaptureVelocity(i,:) = MOTObj.calculateCaptureVelocity(OvenObj, [-OvenObj.OvenDistance,0,0], [cos(theta(i)),0,sin(theta(i))]);
end
f_h = Helper.getFigureByTag('Capture Velocity');
set(groot,'CurrentFigure',f_h);
a_h = get(f_h, 'CurrentAxes');
if ~isempty(get(a_h, 'Children'))
clf(f_h);
end
f_h.Name = 'Capture Velocity';
f_h.Units = 'pixels';
set(0,'units','pixels');
screensize = get(0,'ScreenSize');
f_h.Position = [[screensize(3)/3.5 screensize(4)/3.5] 750 600];
plot(theta .* 1e+03, sqrt(CaptureVelocity(:,1).^2+CaptureVelocity(:,2).^2+CaptureVelocity(:,3).^2), 'Linewidth', 1.5)
hXLabel = xlabel('\theta (mrad)');
hYLabel = ylabel('Velocity (m/s)');
hTitle = sgtitle('Capture velocity for different angles of divergence');
set([hXLabel, hYLabel] , ...
'FontSize' , 14 );
set( hTitle , ...
'FontSize' , 14 );
grid on
Helper.bringFiguresWithTagInForeground();
end