CREATE A ASCRIPT FOR THIS MATLAB CODE LIKE A SENTENCE FORM OF THE STEP BY STEP OF CODE disp ('Calculation of Youngs Modulus and Stress Strain Curves') reply = input('Tensile testing? (y/n): ', 's'); if strcmp(reply,'y') disp('Continue to calculate Youngs Modulus and Stress Strain Curves ') Load1 = input('Enter value for Load 1 (in Newton): '); Load2 = input('Enter value for Load 2 (in Newton): '); Load3 = input('Enter value for Load 3 (in Newton): '); Load4 = input('Enter value for Load 4 (in Newton): '); Load5 = input('Enter value for Load 5 (in Newton): '); Load6 = input('Enter value for Load 6 (in Newton): '); Load7 = input('Enter value for Load 7 (in Newton): '); Load8 = input('Enter value for Load 8 (in Newton): '); Extension1 = input('Enter value for Extension 1 (in meter): '); Extension2 = input('Enter value for Extension 2 (in meter): '); Extension3 = input('Enter value for Extension 3 (in meter): '); Extension4 = input('Enter value for Extension 4 (in meter): '); Extension5 = input('Enter value for Extension 5 (in meter): '); Extension6 = input('Enter value for Extension 6 (in meter): '); Extension7 = input('Enter value for Extension 7 (in meter): '); Extension8 = input('Enter value for Extension 8 (in meter): '); InitialDiameter = input('Enter value for Initial Diameter (in meter): '); InitialLength = input('Enter value for Initial Length (in meter): '); Area = (1/4)*pi*(InitialDiameter^2); A = ['Area (in m3) is ', num2str(Area)]; disp(A) Stress1 = Load1/Area; Stress2 = Load2/Area; Stress3 = Load3/Area; Stress4 = Load4/Area; Stress5 = Load5/Area; Stress6 = Load6/Area; Stress7 = Load7/Area; Stress8 = Load8/Area; Strain1 = Extension1/InitialLength; Strain2 = Extension2/InitialLength; Strain3 = Extension3/InitialLength; Strain4 = Extension4/InitialLength; Strain5 = Extension5/InitialLength; Strain6 = Extension6/InitialLength; Strain7 = Extension7/InitialLength; Strain8 = Extension8/InitialLength; YM1 = Stress1/Strain1; YM2 = Stress2/Strain2; YM3 = Stress3/Strain3; YM4 = Stress4/Strain4; YM5 = Stress5/Strain5; YM6 = Stress6/Strain6; YM7 = Stress7/Strain7; YM8 = Stress8/Strain8; Stress = [Stress1; Stress2; Stress3; Stress4; Stress5; Stress6; Stress7; Stress2]; Strain = [Strain1; Strain2; Strain3; Strain4; Strain5; Strain6; Strain7; Strain8]; YoungsModulus = [YM1; YM2; YM3; YM4; YM5; YM6; YM7; YM8]; T = table(Stress, Strain); T.('Youngs Modulus') = YoungsModulus y = [Stress1, Stress2, Stress3, Stress4, Stress5, Stress6, Stress7, Stress8]; x = [Strain1, Strain2, Strain3, Strain4, Strain5, Strain6, Strain7, Strain8]; plot(x, y, '-bo', 'LineWidth', 2, 'MarkerEdgeColor', 'c', 'MarkerFaceColor', 'y', 'MarkerSize', 5), grid on, xlabel('Strain'), ylabel('Stress'), title('Graph of Stress Strain Curves') f = msgbox('Operation Completed','Success'); elseif strcmp(reply,'n') f = msgbox('Cannot Continue to Calculate Youngs Modulus and Stress Strain Curves', 'Error','error'); end
CREATE A ASCRIPT FOR THIS MATLAB CODE
LIKE A SENTENCE FORM OF THE STEP BY STEP OF CODE
disp ('Calculation of Youngs Modulus and Stress Strain Curves')
reply = input('Tensile testing? (y/n): ', 's');
if strcmp(reply,'y')
disp('Continue to calculate Youngs Modulus and Stress Strain Curves ')
Load1 = input('Enter value for Load 1 (in Newton): ');
Load2 = input('Enter value for Load 2 (in Newton): ');
Load3 = input('Enter value for Load 3 (in Newton): ');
Load4 = input('Enter value for Load 4 (in Newton): ');
Load5 = input('Enter value for Load 5 (in Newton): ');
Load6 = input('Enter value for Load 6 (in Newton): ');
Load7 = input('Enter value for Load 7 (in Newton): ');
Load8 = input('Enter value for Load 8 (in Newton): ');
Extension1 = input('Enter value for Extension 1 (in meter): ');
Extension2 = input('Enter value for Extension 2 (in meter): ');
Extension3 = input('Enter value for Extension 3 (in meter): ');
Extension4 = input('Enter value for Extension 4 (in meter): ');
Extension5 = input('Enter value for Extension 5 (in meter): ');
Extension6 = input('Enter value for Extension 6 (in meter): ');
Extension7 = input('Enter value for Extension 7 (in meter): ');
Extension8 = input('Enter value for Extension 8 (in meter): ');
InitialDiameter = input('Enter value for Initial Diameter (in meter): ');
InitialLength = input('Enter value for Initial Length (in meter): ');
Area = (1/4)*pi*(InitialDiameter^2);
A = ['Area (in m3) is ', num2str(Area)];
disp(A)
Stress1 = Load1/Area;
Stress2 = Load2/Area;
Stress3 = Load3/Area;
Stress4 = Load4/Area;
Stress5 = Load5/Area;
Stress6 = Load6/Area;
Stress7 = Load7/Area;
Stress8 = Load8/Area;
Strain1 = Extension1/InitialLength;
Strain2 = Extension2/InitialLength;
Strain3 = Extension3/InitialLength;
Strain4 = Extension4/InitialLength;
Strain5 = Extension5/InitialLength;
Strain6 = Extension6/InitialLength;
Strain7 = Extension7/InitialLength;
Strain8 = Extension8/InitialLength;
YM1 = Stress1/Strain1;
YM2 = Stress2/Strain2;
YM3 = Stress3/Strain3;
YM4 = Stress4/Strain4;
YM5 = Stress5/Strain5;
YM6 = Stress6/Strain6;
YM7 = Stress7/Strain7;
YM8 = Stress8/Strain8;
Stress = [Stress1; Stress2; Stress3; Stress4; Stress5; Stress6; Stress7; Stress2];
Strain = [Strain1; Strain2; Strain3; Strain4; Strain5; Strain6; Strain7; Strain8];
YoungsModulus = [YM1; YM2; YM3; YM4; YM5; YM6; YM7; YM8];
T = table(Stress, Strain);
T.('Youngs Modulus') = YoungsModulus
y = [Stress1, Stress2, Stress3, Stress4, Stress5, Stress6, Stress7, Stress8];
x = [Strain1, Strain2, Strain3, Strain4, Strain5, Strain6, Strain7, Strain8];
plot(x, y, '-bo', 'LineWidth', 2, 'MarkerEdgeColor', 'c', 'MarkerFaceColor', 'y', 'MarkerSize', 5), grid on, xlabel('Strain'), ylabel('Stress'), title('Graph of Stress Strain Curves')
f = msgbox('Operation Completed','Success');
elseif strcmp(reply,'n')
f = msgbox('Cannot Continue to Calculate Youngs Modulus and Stress Strain Curves', 'Error','error');
end
Step by step
Solved in 2 steps