Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. clc; clear all;
  2. % Plastic Strain Energy Density Script
  3. %Excel File Input
  4. file = 'sample.xlsx';
  5. data = xlsread(file);
  6. % Reading Loading and Un-Loading Half Cycles and Row Quantity
  7. even_samples = 75;
  8. odd_samples = even_samples - 1;
  9. width = even_samples + odd_samples;
  10. data = data(even_samples:end,:); % Ignoring Zero Cycle
  11. l = size(data, 1);
  12. % Ignoring Last Half Cycle
  13. if rem(l,width) ~= 0
  14. l = l - odd_samples;
  15. end
  16. area = zeros(ceil(l/width) , 1); % Area Values for Each Cycle
  17. idx = 1;
  18. i = 1;
  19. while i < l
  20. stress = data(i:i+width, 3); % stress values-> xth column of the data
  21. strain = data(i:i+width, 4); % strain values-> x+1th column of the data
  22. i = i + width;
  23. area(idx) = trapz(stress, strain); % Area of Hysteresis Loop
  24. idx = idx + 1;
  25. end
  26. % Plotting Graph
  27. a = abs(area); % Absolute Value of Area
  28. plot(a);
  29. xlabel('Cycles');
  30. ylabel('Strain Energy Density');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement