%Script to illustrate use of subplot to present results
clear all; clc; close all;

%Generate junk values of shear force etc.
x = linspace(0,2,21);
sforce = x;  
bm = x.^2;
torque = x.^3;

figure(1); clf;
suptitle('Main Shaft Loads');
subplot(3,1,1)
plot(x, sforce, '-k');
xlabel('x (m)');  ylabel('Shear (kN)');

subplot(3,1,2)
plot(x, bm, '-r');
xlabel('x (m)');  ylabel('Moment (kN*m)');
[bm_max, bm_max_index] = max(bm);
hold on;
plot(x(bm_max_index), bm(bm_max_index),'xk');
maxval = num2str(bm(bm_max_index), 4);
text(x(bm_max_index)+0.025 , bm(bm_max_index), maxval );

subplot(3,1,3)
plot(x, torque, '-b');
xlabel('x (m)');  ylabel('Torque (kN*m)');

maxval = num2str(bm(bm_max_index), 4);
text(x(bm_max_index)+0.025 , bm(bm_max_index), maxval );
