Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc; clear all;
- % Plastic Strain Energy Density Script
- %Excel File Input
- file = 'sample.xlsx';
- data = xlsread(file);
- % Reading Loading and Un-Loading Half Cycles and Row Quantity
- even_samples = 75;
- odd_samples = even_samples - 1;
- width = even_samples + odd_samples;
- data = data(even_samples:end,:); % Ignoring Zero Cycle
- l = size(data, 1);
- % Ignoring Last Half Cycle
- if rem(l,width) ~= 0
- l = l - odd_samples;
- end
- area = zeros(ceil(l/width) , 1); % Area Values for Each Cycle
- idx = 1;
- i = 1;
- while i < l
- stress = data(i:i+width, 3); % stress values-> xth column of the data
- strain = data(i:i+width, 4); % strain values-> x+1th column of the data
- i = i + width;
- area(idx) = trapz(stress, strain); % Area of Hysteresis Loop
- idx = idx + 1;
- end
- % Plotting Graph
- a = abs(area); % Absolute Value of Area
- plot(a);
- xlabel('Cycles');
- ylabel('Strain Energy Density');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement