Tugboat M_file Arithmetic Version

Tugboat M_file Arithmetic Version - TResRad = atan2(...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 % Inputs T1F = input('Tug 1 Force (pounds): ') T1D = input('Tug 1 Direction (degrees): ') T2F = input('Tug 2 Force (pounds): ') T2D = input('Tug 2 Direction (degrees): ') T1x = T1F*cosd( T1D ) T1y = T1F*sind( T1D ) T2x = T2F*cosd( T2D ) T2y = T2F*sind( T2D ) TResx = T1x + T2x TResy = T1y + T2y TResF = sqrt( TResx^2 + TResy^2 )
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: TResRad = atan2( TResy,TResx ) TResD = TResRad*180/pi fprintf('\n') fprintf('\t\t\tForce\t\t\tDirection\n') fprintf('Tug 1\t\t%.0f\t\t\t %.0f\n',T1F,T1D) fprintf('Tug 2\t\t%.0f\t\t\t %.0f\n\n',T2F,T2D) fprintf('Total\t\t%.0f\t\t\t %.2f\n',TResF,TResD)...
View Full Document

Ask a homework question - tutors are online