{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":47128,"title":"Test","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 41.6px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 20.8px; transform-origin: 407px 20.8px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 20.8px; text-align: left; transform-origin: 384px 20.8px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ein a given test, a correct answer scores 3 points, while a wrong answer scores -1. determine whether a person passes the test or not. C:correct, N:neutral, W:wrong, the threshhold is 50 out of 90 for a 30 questions test.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nC=20\r\nN=0\r\nW=10\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(C,N,W),y_correct))\r\n\r\n%%\r\nC=19\r\nN=1\r\nW=10\r\ny_correct = 0;\r\nassert(isequal(your_fcn_name(C,N,W),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":430136,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":59,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-29T17:39:50.000Z","updated_at":"2026-02-26T11:45:28.000Z","published_at":"2020-10-29T17:39:50.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ein a given test, a correct answer scores 3 points, while a wrong answer scores -1. determine whether a person passes the test or not. C:correct, N:neutral, W:wrong, the threshhold is 50 out of 90 for a 30 questions test.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":43691,"title":"determine if ","description":"determine if the elements of a matrix is a nan and return true","description_html":"\u003cp\u003edetermine if the elements of a matrix is a nan and return true\u003c/p\u003e","function_template":"function y = my_function(x)\r\n  y = \r\nend","test_suite":"%%\r\nx = [1 0 5 nan];\r\ny_correct = [0 0 0 1]\r\nassert(isequal(my_function(x),y_correct))\r\n%%\r\nx = [nan 1; 5 nan];\r\ny_correct = [1 0;0 1]\r\nassert(isequal(my_function(x),y_correct))\r\n%%\r\nx = [nan nan nan;nan nan nan];\r\ny_correct = [1 1 1;1 1 1]\r\nassert(isequal(my_function(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":88437,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":102,"test_suite_updated_at":"2016-11-28T02:45:31.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-11-28T02:42:32.000Z","updated_at":"2026-02-11T18:28:36.000Z","published_at":"2016-11-28T02:42:32.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edetermine if the elements of a matrix is a nan and return true\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2115,"title":"Test","description":"Answer the question and the correct answer  write in vector. Only one answer is correct.\r\n\r\n 1a Yes\r\n 1b No\r\n 1c No\r\n 1d No\r\n\r\n 2a No\r\n 2b No\r\n 2c Yes\r\n 2d No\r\n\r\n 3a No\r\n 3b No\r\n 3c Yes\r\n 3d No\r\n\r\n 4a No\r\n 4b Yes\r\n 4c No\r\n 4d No\r\n\r\nThe answer is in the form \r\n\r\n function y = res(x)\r\n   y =  ['1a 2c 3c 4b'];\r\n end\r\n","description_html":"\u003cp\u003eAnswer the question and the correct answer  write in vector. Only one answer is correct.\u003c/p\u003e\u003cpre\u003e 1a Yes\r\n 1b No\r\n 1c No\r\n 1d No\u003c/pre\u003e\u003cpre\u003e 2a No\r\n 2b No\r\n 2c Yes\r\n 2d No\u003c/pre\u003e\u003cpre\u003e 3a No\r\n 3b No\r\n 3c Yes\r\n 3d No\u003c/pre\u003e\u003cpre\u003e 4a No\r\n 4b Yes\r\n 4c No\r\n 4d No\u003c/pre\u003e\u003cp\u003eThe answer is in the form\u003c/p\u003e\u003cpre\u003e function y = res(x)\r\n   y =  ['1a 2c 3c 4b'];\r\n end\u003c/pre\u003e","function_template":"function y = res(x)\r\n   y =  ['1a 2b 3c 4d'];\r\nend\r\n","test_suite":"%%\r\nx =  ['1a 2c 3c 4b'];\r\ny_correct =  ['1a 2c 3c 4b'];\r\nassert(isequal(res(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":21325,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":177,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-01-14T11:49:51.000Z","updated_at":"2026-02-19T15:27:48.000Z","published_at":"2014-01-14T11:50:18.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAnswer the question and the correct answer write in vector. Only one answer is correct.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 1a Yes\\n 1b No\\n 1c No\\n 1d No\\n\\n 2a No\\n 2b No\\n 2c Yes\\n 2d No\\n\\n 3a No\\n 3b No\\n 3c Yes\\n 3d No\\n\\n 4a No\\n 4b Yes\\n 4c No\\n 4d No]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe answer is in the form\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ function y = res(x)\\n   y =  ['1a 2c 3c 4b'];\\n end]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43689,"title":"Make an identity matrix whose diagonal elements are 1:n","description":"For a given input n, make an n by n identity matrix that contains the elements 1:n along its diagonal. For example, if input=5:\r\n\r\n output = [1 0 0 0 0;\r\n           0 2 0 0 0;\r\n           0 0 3 0 0;\r\n           0 0 0 4 0;\r\n           0 0 0 0 5]\r\n","description_html":"\u003cp\u003eFor a given input n, make an n by n identity matrix that contains the elements 1:n along its diagonal. For example, if input=5:\u003c/p\u003e\u003cpre\u003e output = [1 0 0 0 0;\r\n           0 2 0 0 0;\r\n           0 0 3 0 0;\r\n           0 0 0 4 0;\r\n           0 0 0 0 5]\u003c/pre\u003e","function_template":"function y = special_eye(n)\r\n  y = n\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 1;\r\nassert(isequal(special_eye(n),y_correct))\r\n%%\r\nn = 2;\r\ny_correct = [1 0;0 2]\r\nassert(isequal(special_eye(n),y_correct))\r\n%%\r\nn = 3;\r\ny_correct = [1 0 0;0 2 0;0 0 3]\r\nassert(isequal(special_eye(n),y_correct))\r\n%%\r\nn = 4;\r\ny_correct = [1 0 0 0;0 2 0 0;0 0 3 0;0 0 0 4]\r\nassert(isequal(special_eye(n),y_correct))\r\n%%\r\nn = 5;\r\ny_correct = [1 0 0 0 0;0 2 0 0 0;0 0 3 0 0; 0 0 0 4 0; 0 0 0 0 5]\r\nassert(isequal(special_eye(n),y_correct))\r\n%%\r\nn = 6;\r\ny_correct = [1 0 0 0 0 0;0 2 0 0 0 0;0 0 3 0 0 0; 0 0 0 4 0 0; 0 0 0 0 5 0; 0 0 0 0 0 6]\r\nassert(isequal(special_eye(n),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":88437,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":123,"test_suite_updated_at":"2016-12-21T21:19:59.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-11-28T02:38:35.000Z","updated_at":"2026-02-10T22:03:12.000Z","published_at":"2016-11-28T02:38:35.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor a given input n, make an n by n identity matrix that contains the elements 1:n along its diagonal. For example, if input=5:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ output = [1 0 0 0 0;\\n           0 2 0 0 0;\\n           0 0 3 0 0;\\n           0 0 0 4 0;\\n           0 0 0 0 5]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":58269,"title":"factorial_calc(n)","description":"Write a MATLAB function called factorial_calc(n) that takes a positive integer n as input and calculates the factorial of n. The factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example, 5! is calculated as 5 * 4 * 3 * 2 * 1 and equals 120.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 63px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 31.5px; transform-origin: 407px 31.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWrite a MATLAB function called \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003efactorial_calc(n)\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e that takes a positive integer \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003en\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e as input and calculates the factorial of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003en\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. The factorial of a non-negative integer \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003en\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e, denoted by \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003en!\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e, is the product of all positive integers less than or equal to \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003en\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. For example, \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e5!\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e is calculated as \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e5 * 4 * 3 * 2 * 1\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e and equals 120.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function result = factorial_calc(n)\r\n  \r\nend","test_suite":"%%\r\nn = 5;\r\nfactorial_result = factorial_calc(n);\r\nfprintf(\"The factorial of %d is %d.\\n\", n, factorial_result);","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":3104740,"edited_by":3104740,"edited_at":"2023-05-06T17:28:54.000Z","deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-05-06T17:28:13.000Z","updated_at":"2026-04-03T13:12:30.000Z","published_at":"2023-05-06T17:28:54.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a MATLAB function called \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efactorial_calc(n)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e that takes a positive integer \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e as input and calculates the factorial of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. The factorial of a non-negative integer \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, denoted by \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en!\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, is the product of all positive integers less than or equal to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. For example, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e5!\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is calculated as \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e5 * 4 * 3 * 2 * 1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and equals 120.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2118,"title":"Test of Quiz","description":"Answer the questions and  write in vector. Only one answer is correct.\r\n\r\nThe founder of fuzzy logic is\r\n\r\n 1a) D. Golberg\r\n 1b) L. Zadeh\r\n 1c) J. Holland\r\n 1d) W. Pitts\r\n\r\nOne of the founders of the artificial neuron model is:\r\n\r\n 2a) W. McCulloch \r\n 2b) R.Williams\r\n 2c) G. Hinton\r\n 2d) P. Man\r\n\r\nThe founder of genetic algorithm is:\r\n\r\n 3a) A. Murphy\r\n 3b) T. Blair\r\n 3c) A. Clifford\r\n 3d) J. Holland\r\n\r\nThe founder of fractals is:\r\n\r\n 4a) A. Einstein\r\n 4b) L. Zadeh\r\n 4c) B. Mandelbrott\r\n 4d) J. Heyrovský\r\n\r\nThe answer is in the form \r\n\r\n function y = res(x)\r\n   y =  ['1a 2b 3c 4d'];\r\n end\r\n","description_html":"\u003cp\u003eAnswer the questions and  write in vector. Only one answer is correct.\u003c/p\u003e\u003cp\u003eThe founder of fuzzy logic is\u003c/p\u003e\u003cpre\u003e 1a) D. Golberg\r\n 1b) L. Zadeh\r\n 1c) J. Holland\r\n 1d) W. Pitts\u003c/pre\u003e\u003cp\u003eOne of the founders of the artificial neuron model is:\u003c/p\u003e\u003cpre\u003e 2a) W. McCulloch \r\n 2b) R.Williams\r\n 2c) G. Hinton\r\n 2d) P. Man\u003c/pre\u003e\u003cp\u003eThe founder of genetic algorithm is:\u003c/p\u003e\u003cpre\u003e 3a) A. Murphy\r\n 3b) T. Blair\r\n 3c) A. Clifford\r\n 3d) J. Holland\u003c/pre\u003e\u003cp\u003eThe founder of fractals is:\u003c/p\u003e\u003cpre\u003e 4a) A. Einstein\r\n 4b) L. Zadeh\r\n 4c) B. Mandelbrott\r\n 4d) J. Heyrovský\u003c/pre\u003e\u003cp\u003eThe answer is in the form\u003c/p\u003e\u003cpre\u003e function y = res(x)\r\n   y =  ['1a 2b 3c 4d'];\r\n end\u003c/pre\u003e","function_template":"function y = res(x)\r\n  y = x;\r\nend\r\n","test_suite":"%%\r\nx =  ['1b 2c 3d 4c'];\r\ny_correct =  ['1b 2c 3d 4c'];\r\nassert(isequal(res(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":21325,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":191,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-01-14T13:47:25.000Z","updated_at":"2026-02-09T18:04:45.000Z","published_at":"2014-01-14T13:47:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAnswer the questions and write in vector. Only one answer is correct.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe founder of fuzzy logic is\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 1a) D. Golberg\\n 1b) L. Zadeh\\n 1c) J. Holland\\n 1d) W. Pitts]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOne of the founders of the artificial neuron model is:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 2a) W. McCulloch \\n 2b) R.Williams\\n 2c) G. Hinton\\n 2d) P. Man]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe founder of genetic algorithm is:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 3a) A. Murphy\\n 3b) T. Blair\\n 3c) A. Clifford\\n 3d) J. Holland]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe founder of fractals is:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 4a) A. Einstein\\n 4b) L. Zadeh\\n 4c) B. Mandelbrott\\n 4d) J. Heyrovský]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe answer is in the form\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ function y = res(x)\\n   y =  ['1a 2b 3c 4d'];\\n end]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":46711,"title":"Test - Add sequence of numbers with given start, step, and end","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 141px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 70.5px; transform-origin: 407px 70.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eTest problem (to learn how to create problems)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eGiven i = initial value\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e          n = step value\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e          e = end value\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eFind the sum of the generated sequence\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function s = sum_seq(i,n,e)\r\n  s = 0;\r\nend","test_suite":"%%\r\ni=3\r\nn=3\r\ne=90\r\ny_correct = 1395;\r\nassert(isequal(sum_seq(i,n,e),y_correct))\r\n\r\n%%\r\n\r\ni=-10\r\nn=1.5\r\ne=200\r\ny_correct = 13395;\r\nassert(isequal(sum_seq(i,n,e),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":417672,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":50,"test_suite_updated_at":"2020-10-09T01:21:01.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-09T01:19:51.000Z","updated_at":"2026-02-16T16:16:33.000Z","published_at":"2020-10-09T01:19:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTest problem (to learn how to create problems)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven i = initial value\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e          n = step value\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e          e = end value\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the sum of the generated sequence\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":43694,"title":"find the 'M'","description":"for an input x, return 1 at the location of the letter 'M'","description_html":"\u003cp\u003efor an input x, return 1 at the location of the letter 'M'\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y=\r\nend","test_suite":"%%\r\nx = [1 5;'M' 7];\r\ny_correct = [0 0;1 0]\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = ['M' 7  7;1 'M' 6; 5 8 'M'];\r\ny_correct = [1 0 0;0 1 0;0 0 1]\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":88437,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":73,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-11-28T03:05:12.000Z","updated_at":"2026-02-18T09:30:35.000Z","published_at":"2016-11-28T03:05:12.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor an input x, return 1 at the location of the letter 'M'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1375,"title":"select the primes of a vector","description":"Find the prime numbers in a vector","description_html":"\u003cp\u003eFind the prime numbers in a vector\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [1 2 3 4 5 31 67];\r\ny_correct = [2 3 5 31 67];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":12098,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":321,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-03-22T16:30:19.000Z","updated_at":"2026-02-17T14:58:03.000Z","published_at":"2013-03-22T16:30:19.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the prime numbers in a vector\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8048,"title":"Stress-Strain Properties - 1","description":"This is the first in a series of problems regarding mechanics of materials, in particular, material properties drawn from stress-strain responses. A simplified typical stress-strain response is illustrated below (from quora.com):\r\n\r\nThe yield stress is the pressure required to start deformation of the material being tested. The yield point is the point along the response indicated by the yield stress (vertical axis) and the yield strain (horizontal axis). The response of the material up to this point is elastic, meaning that all deformation is reversible. The elastic modulus (E, also known as modulus of elasticity or Young's modulus) is the slope of this line. Write a function to calculate the elastic modulus for a material, provided the elastic strain and yield stress (yield point).\r\nNext problem: 2 - resilience.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440001px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 541px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 270.5px; transform-origin: 332px 270.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 31.5px; text-align: left; transform-origin: 309px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThis is the first in a series of problems regarding mechanics of materials, in particular, material properties drawn from stress-strain responses. A simplified typical stress-strain response is illustrated below (from\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e quora.com):\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 304px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 152px; text-align: center; transform-origin: 309px 152px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline\" src=\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 126px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 63px; text-align: left; transform-origin: 309px 63px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe yield stress is the pressure required to start deformation of the material being tested. The yield point is the point along the response indicated by the yield stress (vertical axis) and the yield strain (horizontal axis). The response of the material up to this point is elastic, meaning that all deformation is reversible. The elastic modulus (E, also known as modulus of elasticity or Young's modulus) is the slope of this line. Write a function to calculate the elastic modulus for a material, provided the elastic strain and yield stress (yield point).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: left; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eNext problem: 2 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/8049-stress-strain-properties-2\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eresilience\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [E] = stress_strain1(S_y,e_y)\r\n\r\nE = 1;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile \r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient 530MPa\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e9; %Pa\r\ndensity = 1.14; %g/cm^3\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":26769,"edited_by":26769,"edited_at":"2024-03-27T17:40:39.000Z","deleted_by":null,"deleted_at":null,"solvers_count":324,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T18:09:31.000Z","updated_at":"2026-03-31T10:50:52.000Z","published_at":"2015-03-30T18:09:58.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the first in a series of problems regarding mechanics of materials, in particular, material properties drawn from stress-strain responses. A simplified typical stress-strain response is illustrated below (from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e quora.com):\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe yield stress is the pressure required to start deformation of the material being tested. The yield point is the point along the response indicated by the yield stress (vertical axis) and the yield strain (horizontal axis). The response of the material up to this point is elastic, meaning that all deformation is reversible. The elastic modulus (E, also known as modulus of elasticity or Young's modulus) is the slope of this line. Write a function to calculate the elastic modulus for a material, provided the elastic strain and yield stress (yield point).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNext problem: 2 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/8049-stress-strain-properties-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eresilience\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"contentType\":\"image/net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"content\":\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2,"title":"Make the vector [1 2 3 4 5 6 7 8 9 10]","description":"In MATLAB, you create a vector by enclosing the elements in square brackets like so:\r\n\r\n x = [1 2 3 4]\r\n\r\nCommas are optional, so you can also type\r\n\r\n x = [1, 2, 3, 4]\r\n\r\nCreate the vector\r\n\r\n x = [1 2 3 4 5 6 7 8 9 10]\r\n\r\nThere's a faster way to do it using MATLAB's \u003chttp://www.mathworks.com/help/techdoc/ref/colon.html colon notation\u003e.","description_html":"\u003cp\u003eIn MATLAB, you create a vector by enclosing the elements in square brackets like so:\u003c/p\u003e\u003cpre\u003e x = [1 2 3 4]\u003c/pre\u003e\u003cp\u003eCommas are optional, so you can also type\u003c/p\u003e\u003cpre\u003e x = [1, 2, 3, 4]\u003c/pre\u003e\u003cp\u003eCreate the vector\u003c/p\u003e\u003cpre\u003e x = [1 2 3 4 5 6 7 8 9 10]\u003c/pre\u003e\u003cp\u003eThere's a faster way to do it using MATLAB's \u003ca href = \"http://www.mathworks.com/help/techdoc/ref/colon.html\"\u003ecolon notation\u003c/a\u003e.\u003c/p\u003e","function_template":"function x = oneToTen\r\n  x = 0;\r\nend","test_suite":"%%\r\nx_correct = [1 2 3 4 5 6 7 8 9 10];\r\nassert(isequal(oneToTen,x_correct))","published":true,"deleted":false,"likes_count":224,"comments_count":56,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":52929,"test_suite_updated_at":"2012-01-18T01:00:17.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:17.000Z","updated_at":"2026-04-05T10:28:15.000Z","published_at":"2012-01-18T01:00:17.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn MATLAB, you create a vector by enclosing the elements in square brackets like so:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [1 2 3 4]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCommas are optional, so you can also type\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [1, 2, 3, 4]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCreate the vector\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [1 2 3 4 5 6 7 8 9 10]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere's a faster way to do it using MATLAB's\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/help/techdoc/ref/colon.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ecolon notation\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8051,"title":"Stress-Strain Properties - 4","description":"A common measure of the ability of a material to carry load per unit mass is termed strength-to-weight ratio and is calculated by dividing the ultimate tensile strength of the material by its density. This property is key in weight-critical applications, such as aerospace, where many materials with high strength-to-weight ratios are used (e.g., Ni-based superalloys, Ti-based alloys, Al-based alloys, and composites).\r\n\r\nWrite a function to calculate the strength-to-weight ratio for a given material provided its ultimate tensile strength and density.\r\n\r\nPrevious problem: 3 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8050-stress-strain-properties-3 qualitative measure of brittleness\u003e. Next problem: 5 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8052-stress-strain-properties-5 stiffness-to-weight ratio\u003e.","description_html":"\u003cp\u003eA common measure of the ability of a material to carry load per unit mass is termed strength-to-weight ratio and is calculated by dividing the ultimate tensile strength of the material by its density. This property is key in weight-critical applications, such as aerospace, where many materials with high strength-to-weight ratios are used (e.g., Ni-based superalloys, Ti-based alloys, Al-based alloys, and composites).\u003c/p\u003e\u003cp\u003eWrite a function to calculate the strength-to-weight ratio for a given material provided its ultimate tensile strength and density.\u003c/p\u003e\u003cp\u003ePrevious problem: 3 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8050-stress-strain-properties-3\"\u003equalitative measure of brittleness\u003c/a\u003e. Next problem: 5 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8052-stress-strain-properties-5\"\u003estiffness-to-weight ratio\u003c/a\u003e.\u003c/p\u003e","function_template":"function [StWR] = stress_strain4(S_u,density)\r\n\r\nStWR = 1;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nStWR_corr = 5.096e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nStWR_corr = 19.96e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nStWR_corr = 17.18e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nStWR_corr = 11.11e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient\r\nStWR_corr = 2.466e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nStWR_corr = 5.376e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e-2; %Pa\r\ndensity = 1.14; %g/cm^3\r\nStWR_corr = 7.193e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nStWR_corr = 15.23e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nStWR_corr = 34.19e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_u = 400e6; %Pa\r\n\t\tdensity = 7.85; %g/cm^3\r\n\t\tStWR_corr = 5.096e7;\r\n\tcase 2\r\n\t\tS_u = 230e6; %Pa\r\n\t\tdensity = 1.51; %g/cm^3\r\n\t\tStWR_corr = 15.23e7;\r\n\tcase 3\r\n\t\tS_u = 1130e6; %Pa\r\n\t\tdensity = 21.02; %g/cm^3\r\n\t\tStWR_corr = 5.376e7;\r\n\tcase 4\r\n\t\tS_u = 1200e6; %Pa\r\n\t\tdensity = 3.51; %g/cm^3\r\n\t\tStWR_corr = 34.19e7;\r\nend\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_u = 300e6; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tStWR_corr = 11.11e7;\r\n\tcase 2\r\n\t\tS_u = 900e6; %Pa\r\n\t\tdensity = 4.51; %g/cm^3\r\n\t\tStWR_corr = 19.96e7;\r\n\tcase 3\r\n\t\tS_u = 220e6; %Pa\r\n\t\tdensity = 8.92; %g/cm^3\r\n\t\tStWR_corr = 2.466e7;\r\n\tcase 4\r\n\t\tS_u = 230e6; %Pa\r\n\t\tdensity = 1.51; %g/cm^3\r\n\t\tStWR_corr = 15.23e7;\r\nend\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_u = 300e6; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tStWR_corr = 11.11e7;\r\n\tcase 2\r\n\t\tS_u = 1200e6; %Pa\r\n\t\tdensity = 3.51; %g/cm^3\r\n\t\tStWR_corr = 34.19e7;\r\n\tcase 3\r\n\t\tS_u = 82e6; %Pa\r\n\t\tdensity = 1.14; %g/cm^3\r\n\t\tStWR_corr = 7.193e7;\r\n\tcase 4\r\n\t\tS_u = 900e6; %Pa\r\n\t\tdensity = 4.51; %g/cm^3\r\n\t\tStWR_corr = 19.96e7;\r\nend\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":222,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T19:24:41.000Z","updated_at":"2026-03-10T20:20:32.000Z","published_at":"2015-03-30T19:24:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA common measure of the ability of a material to carry load per unit mass is termed strength-to-weight ratio and is calculated by dividing the ultimate tensile strength of the material by its density. This property is key in weight-critical applications, such as aerospace, where many materials with high strength-to-weight ratios are used (e.g., Ni-based superalloys, Ti-based alloys, Al-based alloys, and composites).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to calculate the strength-to-weight ratio for a given material provided its ultimate tensile strength and density.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 3 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8050-stress-strain-properties-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003equalitative measure of brittleness\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 5 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8052-stress-strain-properties-5\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estiffness-to-weight ratio\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8052,"title":"Stress-Strain Properties - 5","description":"Similar to the previous problem, materials may be characterized by their stiffness-to-weight ratio, which is the elastic modulus divided by density. Write a function to calculate this ratio for a material provided its elastic modulus and density.\r\n\r\nPrevious problem: 4 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8051-stress-strain-properties-4 strength-to-weight ratio\u003e. Next problem: 6 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8053-stress-strain-properties-6 absorbed strain energy\u003e.","description_html":"\u003cp\u003eSimilar to the previous problem, materials may be characterized by their stiffness-to-weight ratio, which is the elastic modulus divided by density. Write a function to calculate this ratio for a material provided its elastic modulus and density.\u003c/p\u003e\u003cp\u003ePrevious problem: 4 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8051-stress-strain-properties-4\"\u003estrength-to-weight ratio\u003c/a\u003e. Next problem: 6 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8053-stress-strain-properties-6\"\u003eabsorbed strain energy\u003c/a\u003e.\u003c/p\u003e","function_template":"function [EtWR] = stress_strain5(E,density)\r\n\r\nEtWR = 1\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nEtWR_corr = 2.548e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nEtWR_corr = 2.528e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nEtWR_corr = 2.540e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nEtWR_corr = 2.552e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient\r\nEtWR_corr = 1.457e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nEtWR_corr = 2.203e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e9; %Pa\r\ndensity = 1.14; %g/cm^3\r\nEtWR_corr = 0.272e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nEtWR_corr = 0.960e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nEtWR_corr = 34.19e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tE = 114e9; %Pa\r\n\t\tdensity = 4.51; %g/cm^3\r\n\t\tEtWR_corr = 2.528e10;\r\n\tcase 2\r\n\t\tE = 68.9e9; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tEtWR_corr = 2.552e10;\r\n\tcase 3\r\n\t\tE = 200e9; %Pa\r\n\t\tdensity = 7.85; %g/cm^3\r\n\t\tEtWR_corr = 2.548e10;\r\n\tcase 4\r\n\t\tE = 1200e9; %Pa\r\n\t\tdensity = 3.51; %g/cm^3\r\n\t\tEtWR_corr = 34.19e10;\r\nend\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tE = 68.9e9; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tEtWR_corr = 2.552e10;\r\n\tcase 2\r\n\t\tE = 3.1e9; %Pa\r\n\t\tdensity = 1.14; %g/cm^3\r\n\t\tEtWR_corr = 0.272e10;\r\n\tcase 3\r\n\t\tE = 14.5e9; %Pa\r\n\t\tdensity = 1.51; %g/cm^3\r\n\t\tEtWR_corr = 0.960e10;\r\n\tcase 4\r\n\t\tE = 208e9; %Pa\r\n\t\tdensity = 8.19; %g/cm^3\r\n\t\tEtWR_corr = 2.540e10;\r\nend\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tE = 208e9; %Pa\r\n\t\tdensity = 8.19; %g/cm^3\r\n\t\tEtWR_corr = 2.540e10;\r\n\tcase 2\r\n\t\tE = 463e9; %Pa\r\n\t\tdensity = 21.02; %g/cm^3\r\n\t\tEtWR_corr = 2.203e10;\r\n\tcase 3\r\n\t\tE = 130e9; %Pa\r\n\t\tdensity = 8.92; %g/cm^3\r\n\t\tEtWR_corr = 1.457e10;\r\n\tcase 4\r\n\t\tE = 3.1e9; %Pa\r\n\t\tdensity = 1.14; %g/cm^3\r\n\t\tEtWR_corr = 0.272e10;\r\nend\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":212,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T19:40:12.000Z","updated_at":"2026-03-10T20:42:38.000Z","published_at":"2015-03-30T19:40:12.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSimilar to the previous problem, materials may be characterized by their stiffness-to-weight ratio, which is the elastic modulus divided by density. Write a function to calculate this ratio for a material provided its elastic modulus and density.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 4 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8051-stress-strain-properties-4\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estrength-to-weight ratio\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 6 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8053-stress-strain-properties-6\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eabsorbed strain energy\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8049,"title":"Stress-Strain Properties - 2","description":"The resilience of a material is its ability to resist permanent (or plastic) deformation. The resilience coincides with the elastic region in the figure below and is calculated as the area under the stress-strain curve up to the yield point. Given that the elastic region is presumed to be entirely linear, this area is a triangle. Write a function to calculate the resilience of a material provided its elastic strain and yield stress (yield strength).\r\n\r\n(from quora.com)\r\nPrevious problem: 1 - elastic modulus. Next problem: 3 - qualitative measure of brittleness.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440001px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 478px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 239px; transform-origin: 332px 239px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 105px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 52.5px; text-align: left; transform-origin: 309px 52.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe resilience of a material is its ability to resist permanent (or plastic) deformation. The resilience coincides with the elastic region in the figure below and is calculated as the area under the stress-strain curve up to the yield point. Given that the elastic region is presumed to be entirely linear, this area is a triangle. Write a function to calculate the resilience of a material provided its elastic strain and yield stress (yield strength).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 304px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 152px; text-align: center; transform-origin: 309px 152px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline\" src=\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: center; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e(from quora.com)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: left; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ePrevious problem: 1 - \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/8048-stress-strain-properties-1\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eelastic modulus\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. Next problem: 3 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003equalitative measure of brittleness\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [R] = stress_strain2(S_y,e_y)\r\n\r\nR = 1;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nassert(abs(stress_strain2(S_y,e_y)-1.5625e5)/1.5625e5\u003c5e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nassert(abs(stress_strain2(S_y,e_y)-3.0212e6)/3.0212e6\u003c5e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nassert(abs(stress_strain2(S_y,e_y)-3.29918e6)/3.29918e6\u003c5e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nassert(abs(stress_strain2(S_y,e_y)-4.2175e5)/4.2175e5\u003c5e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient 530MPa\r\nassert(abs(stress_strain2(S_y,e_y)-1.89e4)/1.89e4\u003c5e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nassert(abs(stress_strain2(S_y,e_y)-1.085725e5)/1.085725e5\u003c5e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.5e-2; %Pa\r\ndensity = 1.14; %g/cm^3\r\nassert(abs(stress_strain2(S_y,e_y)-1.0865e6)/1.0865e6\u003c5e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nassert(abs(stress_strain2(S_y,e_y)-1.84e6)/1.84e6\u003c5e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nassert(abs(stress_strain2(S_y,e_y)-6e5)/6e5\u003c5e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 250e6; %Pa\r\n\t\te_y = 0.00125;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.5625e5)/1.5625e5\u003c5e-2)\r\n\tcase 2\r\n\t\tS_y = 82e6; %Pa\r\n\t\te_y = 0.0265;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.0865e6)/1.0865e6\u003c5e-2)\r\n\tcase 3\r\n\t\tS_y = 241e6; %Pa\r\n\t\te_y = 0.0035;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-4.2175e5)/4.2175e5\u003c5e-2)\r\n\tcase 4\r\n\t\tS_y = 1172e6; %Pa\r\n\t\te_y = 0.00563;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-3.29918e6)/3.29918e6\u003c5e-2)\r\nend\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 1200e6; %Pa\r\n\t\te_y = 0.001;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-6e5)/6e5\u003c5e-2)\r\n\tcase 2\r\n\t\tS_y = 1172e6; %Pa\r\n\t\te_y = 0.00563;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-3.29918e6)/3.29918e6\u003c5e-2)\r\n\tcase 3\r\n\t\tS_y = 230e6; %Pa\r\n\t\te_y = 0.016;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.84e6)/1.84e6\u003c5e-2)\r\n\tcase 4\r\n\t\tS_y = 250e6; %Pa\r\n\t\te_y = 0.00125;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.5625e5)/1.5625e5\u003c5e-2)\r\nend\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 830e6; %Pa\r\n\t\te_y = 0.00728;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-3.0212e6)/3.0212e6\u003c5e-2)\r\n\tcase 2\r\n\t\tS_y = 230e6; %Pa\r\n\t\te_y = 0.016;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.84e6)/1.84e6\u003c5e-2)\r\n\tcase 3\r\n\t\tS_y = 70e6; %Pa\r\n\t\te_y = 0.00054;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.89e4)/1.89e4\u003c5e-2)\r\n\tcase 4\r\n\t\tS_y = 317e6; %Pa\r\n\t\te_y = 0.000685;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.085725e5)/1.085725e5\u003c5e-2)\r\nend\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":26769,"edited_at":"2024-03-27T17:41:09.000Z","deleted_by":null,"deleted_at":null,"solvers_count":264,"test_suite_updated_at":"2015-03-30T18:44:33.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T18:27:49.000Z","updated_at":"2026-03-31T10:53:49.000Z","published_at":"2015-03-30T18:27:49.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe resilience of a material is its ability to resist permanent (or plastic) deformation. The resilience coincides with the elastic region in the figure below and is calculated as the area under the stress-strain curve up to the yield point. Given that the elastic region is presumed to be entirely linear, this area is a triangle. Write a function to calculate the resilience of a material provided its elastic strain and yield stress (yield strength).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(from quora.com)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 1 - \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/8048-stress-strain-properties-1\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eelastic modulus\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 3 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003equalitative measure of brittleness\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"contentType\":\"image/net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"content\":\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45206,"title":"How to find the position of an element in a vector without using the find function","description":"Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for.","description_html":"\u003cp\u003eWrite a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for.\u003c/p\u003e","function_template":"function posX=findPosition (x,y)\r\nend","test_suite":"%%\r\nx = [1 3 5 4 2];\r\ny=2;\r\n lap=5;\r\nassert(isequal(findPosition (x,y),lap))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":351145,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":43,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-18T15:07:25.000Z","updated_at":"2026-03-11T11:49:41.000Z","published_at":"2019-11-18T15:07:25.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8050,"title":"Stress-Strain Properties - 3","description":"A brittle material will not exhibit a yield point. In other words, the yield point and failure point coincide. In such cases, the yield strain and failure strain (also known as ultimate strain or elongation) are the same value. On the other hand, ductile materials have a failure strain that is significantly greater than the elastic strain, as shown in the figure below.\r\n\r\n(from quora.com)\r\nWrite a function to determine the qualitative brittleness of the material by calculating the ratio of elastic strain to failure strain. A ratio of one indicates complete brittleness, whereas a ratio close to zero indicates essentially no brittleness.\r\nPrevious problem: 2 - resilience. Next problem: 4 - strength-to-weight ratio.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440001px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 529px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 264.5px; transform-origin: 332px 264.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 42px; text-align: left; transform-origin: 309px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eA brittle material will not exhibit a yield point. In other words, the yield point and failure point coincide. In such cases, the yield strain and failure strain (also known as ultimate strain or elongation) are the same value. On the other hand, ductile materials have a failure strain that is significantly greater than the elastic strain, as shown in the figure below.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 304px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 152px; text-align: center; transform-origin: 309px 152px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline\" src=\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: center; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e(from quora.com)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 31.5px; text-align: left; transform-origin: 309px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWrite a function to determine the qualitative brittleness of the material by calculating the ratio of elastic strain to failure strain. A ratio of one indicates complete brittleness, whereas a ratio close to zero indicates essentially no brittleness.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: left; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ePrevious problem: 2 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/8049-stress-strain-properties-2\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eresilience\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. Next problem: 4 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003estrength-to-weight ratio\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [BR] = stress_strain3(e_y,e_u)\r\n\r\nBR = 1;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nBR_corr = 0.003571;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nBR_corr = 0.052;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nBR_corr = 0.2085;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nBR_corr = 0.02333;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient\r\nBR_corr = 0.001125;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nBR_corr = 0.002854;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e-2; %Pa\r\ndensity = 1.14; %g/cm^3\r\nBR_corr = 0.058889;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nBR_corr = 1.0;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nBR_corr = 1.0;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\te_y = 0.00125;\r\n\t\te_u = 0.35;\r\n\t\tBR_corr = 0.003571;\r\n\tcase 2\r\n\t\te_y = 0.00054;\r\n\t\te_u = 0.48;\r\n\t\tBR_corr = 0.001125;\r\n\tcase 3\r\n\t\te_y = 0.0035;\r\n\t\te_u = 0.15;\r\n\t\tBR_corr = 0.02333;\r\n\tcase 4\r\n\t\te_y = 0.00054;\r\n\t\te_u = 0.48;\r\n\t\tBR_corr = 0.001125;\r\nend\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\te_y = 0.0265;\r\n\t\te_u = 0.45;\r\n\t\tBR_corr = 0.058889;\r\n\tcase 2\r\n\t\te_y = 0.00728;\r\n\t\te_u = 0.14;\r\n\t\tBR_corr = 0.052;\r\n\tcase 3\r\n\t\te_y = 0.00563;\r\n\t\te_u = 0.027;\r\n\t\tBR_corr = 0.2085;\r\n\tcase 4\r\n\t\te_y = 0.016;\r\n\t\te_u = 0.016;\r\n\t\tBR_corr = 1.0;\r\nend\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\te_y = 0.00125;\r\n\t\te_u = 0.35;\r\n\t\tBR_corr = 0.003571;\r\n\tcase 2\r\n\t\te_y = 0.00563;\r\n\t\te_u = 0.027;\r\n\t\tBR_corr = 0.2085;\r\n\tcase 3\r\n\t\te_y = 0.00728;\r\n\t\te_u = 0.14;\r\n\t\tBR_corr = 0.052;\r\n\tcase 4\r\n\t\te_y = 0.00054;\r\n\t\te_u = 0.48;\r\n\t\tBR_corr = 0.001125;\r\nend\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":26769,"edited_by":26769,"edited_at":"2024-03-27T17:42:29.000Z","deleted_by":null,"deleted_at":null,"solvers_count":241,"test_suite_updated_at":"2015-03-30T18:54:51.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T18:53:23.000Z","updated_at":"2026-03-31T10:56:32.000Z","published_at":"2015-03-30T18:53:23.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA brittle material will not exhibit a yield point. In other words, the yield point and failure point coincide. In such cases, the yield strain and failure strain (also known as ultimate strain or elongation) are the same value. On the other hand, ductile materials have a failure strain that is significantly greater than the elastic strain, as shown in the figure below.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(from quora.com)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine the qualitative brittleness of the material by calculating the ratio of elastic strain to failure strain. A ratio of one indicates complete brittleness, whereas a ratio close to zero indicates essentially no brittleness.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 2 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/8049-stress-strain-properties-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eresilience\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 4 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estrength-to-weight ratio\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"contentType\":\"image/net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"content\":\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":43014,"title":"Beat the test suite if you can :)","description":"Solve this problem based on clues in the test suite.","description_html":"\u003cp\u003eSolve this problem based on clues in the test suite.\u003c/p\u003e","function_template":"function y = beatMe(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [1 2 4 6 4];\r\ny_correct = true;\r\nassert(isequal(beatMe(x),y_correct))\r\n\r\n%%\r\nx = [1 8 3 2 4];\r\ny_correct = true;\r\nassert(isequal(beatMe(x),y_correct))\r\n\r\n%%\r\nx = [7 100003 4000002 6.020 4.1];\r\ny_correct = false;\r\nassert(isequal(beatMe(x),y_correct))\r\n\r\n%%\r\nx = [1 21 45 16 4];\r\ny_correct = false;\r\nassert(isequal(beatMe(x),y_correct))\r\n\r\n%%\r\nx = [1 3 3 2];\r\ny_correct = false;\r\nassert(isequal(beatMe(x),y_correct))","published":true,"deleted":false,"likes_count":10,"comments_count":1,"created_by":13865,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":87,"test_suite_updated_at":"2016-10-29T17:15:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-04T10:27:25.000Z","updated_at":"2026-03-16T10:58:34.000Z","published_at":"2016-10-04T10:28:42.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolve this problem based on clues in the test suite.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43977,"title":"Converting binary to decimals","description":"Convert binary to decimals.\r\n\r\nExample:\r\n\r\n010111 = 23. \r\n\r\n110000 = 48.","description_html":"\u003cp\u003eConvert binary to decimals.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003e010111 = 23.\u003c/p\u003e\u003cp\u003e110000 = 48.\u003c/p\u003e","function_template":"function y = bin_to_dec(d)\r\n  y = d;\r\nend","test_suite":"%%\r\nd = ('010111');\r\ny_correct = 23;\r\nassert(isequal(bin_to_dec(d),y_correct))\r\n\r\n%%\r\nd = ('110000');\r\ny_correct = 48;\r\nassert(isequal(bin_to_dec(d),y_correct))\r\n\r\n%%\r\nd = ('1000110');\r\ny_correct = 70;\r\nassert(isequal(bin_to_dec(d),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":1,"created_by":108624,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1701,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-12-29T13:49:15.000Z","updated_at":"2026-04-01T08:57:55.000Z","published_at":"2016-12-29T13:51:20.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConvert binary to decimals.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e010111 = 23.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e110000 = 48.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8055,"title":"Stress-Strain Properties - 8","description":"Up to this point, you've calculated some material properties based on tensile stress-strain data. For this problem, you are tasked with writing a function to calculate all of these properties and gather them, along with supplied properties, such as strain values, into an array. You'll be provided a cell array of strings in the function template; you must return an accompanying numerical array that contains all the specified properties. Below is the list of properties for a material, both supplied and calculated, that make up the array (with variable names that have been used):\r\n\r\n* Yield Strength (S_y)\r\n* Yield Strain (e_y)\r\n* Ultimate Strength (S_u)\r\n* Failure Strain (e_u)\r\n* Poisson's Ratio (nu)\r\n* Shear Modulus (G)\r\n* Elastic Modulus (E)\r\n* Density\r\n* Strain-hardening Exponent (sh_exp)\r\n* Strain-hardening Coefficient (sh_coeff)\r\n* Resilience (R)\r\n* Strength-to-weight Ratio (StWR)\r\n* Stiffness-to-weight Ratio (EtWR)\r\n* Absorbed Strain Energy (ASE)\r\n* Toughness (T)\r\n\r\nPrevious problem: 7 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8054-stress-strain-properties-7 toughness\u003e.","description_html":"\u003cp\u003eUp to this point, you've calculated some material properties based on tensile stress-strain data. For this problem, you are tasked with writing a function to calculate all of these properties and gather them, along with supplied properties, such as strain values, into an array. You'll be provided a cell array of strings in the function template; you must return an accompanying numerical array that contains all the specified properties. Below is the list of properties for a material, both supplied and calculated, that make up the array (with variable names that have been used):\u003c/p\u003e\u003cul\u003e\u003cli\u003eYield Strength (S_y)\u003c/li\u003e\u003cli\u003eYield Strain (e_y)\u003c/li\u003e\u003cli\u003eUltimate Strength (S_u)\u003c/li\u003e\u003cli\u003eFailure Strain (e_u)\u003c/li\u003e\u003cli\u003ePoisson's Ratio (nu)\u003c/li\u003e\u003cli\u003eShear Modulus (G)\u003c/li\u003e\u003cli\u003eElastic Modulus (E)\u003c/li\u003e\u003cli\u003eDensity\u003c/li\u003e\u003cli\u003eStrain-hardening Exponent (sh_exp)\u003c/li\u003e\u003cli\u003eStrain-hardening Coefficient (sh_coeff)\u003c/li\u003e\u003cli\u003eResilience (R)\u003c/li\u003e\u003cli\u003eStrength-to-weight Ratio (StWR)\u003c/li\u003e\u003cli\u003eStiffness-to-weight Ratio (EtWR)\u003c/li\u003e\u003cli\u003eAbsorbed Strain Energy (ASE)\u003c/li\u003e\u003cli\u003eToughness (T)\u003c/li\u003e\u003c/ul\u003e\u003cp\u003ePrevious problem: 7 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8054-stress-strain-properties-7\"\u003etoughness\u003c/a\u003e.\u003c/p\u003e","function_template":"function [arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff)\r\n\r\narr_descr = {\r\n\t'Yield Strength','Yield Strain','Ultimate Strength','Failure Strain',...\r\n\t'Poisson''s Ratio','Shear Modulus','Elastic Modulus','Density',...\r\n\t'Strain-hardening Exponent','Strain-hardening Coefficient',...\r\n\t'Resilience','Strength-to-weight Ratio','Stiffness-to-weight Ratio',...\r\n\t'Absorbed Strain Energy','Toughness';\r\n};\r\n\r\narr_vals = [\r\n\t1;\r\n];\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26; %Poisson's ratio\r\nG = 79.3e9; %Pa (shear modulus)\r\nE = 200e9; %Pa  (elastic modulus)\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 463e6; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t1.5625e5, 5.096e7, 2.548e10, 12.28e7, 12.26e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 974e6; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t3.0212e6, 19.96e7, 2.528e10, 12.12e7, 11.82e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1845e6; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t3.29918e6, 17.18e7, 2.540e10, 3.535e7, 3.205e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 325e6; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t4.2175e5, 11.11e7, 2.552e10, 4.321e7, 4.279e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 304e6; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t1.89e4, 2.466e7, 1.457e10, 7.342e7, 7.340e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1870e6; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t1.085725e5, 5.376e7, 2.203e10, 20.06e7, 20.05e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e9; %Pa\r\ndensity = 1.14; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t1.0865e6, 7.193e7, 0.272e10, 3.581e7, 3.473e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\ndiffs(isnan(diffs)) = 0;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t1.84e6, 15.23e7, 0.960e10, 0.184e7, 0];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\ndiffs(isnan(diffs)) = 0;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t6e5, 34.19e7, 34.19e10, 0.06e7, 0];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\ndiffs(isnan(diffs)) = 0;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":48,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-31T02:36:58.000Z","updated_at":"2026-02-19T09:49:12.000Z","published_at":"2015-03-31T02:36:58.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eUp to this point, you've calculated some material properties based on tensile stress-strain data. For this problem, you are tasked with writing a function to calculate all of these properties and gather them, along with supplied properties, such as strain values, into an array. You'll be provided a cell array of strings in the function template; you must return an accompanying numerical array that contains all the specified properties. Below is the list of properties for a material, both supplied and calculated, that make up the array (with variable names that have been used):\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYield Strength (S_y)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYield Strain (e_y)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eUltimate Strength (S_u)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFailure Strain (e_u)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePoisson's Ratio (nu)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eShear Modulus (G)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eElastic Modulus (E)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDensity\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eStrain-hardening Exponent (sh_exp)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eStrain-hardening Coefficient (sh_coeff)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eResilience (R)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eStrength-to-weight Ratio (StWR)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eStiffness-to-weight Ratio (EtWR)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAbsorbed Strain Energy (ASE)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eToughness (T)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 7 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8054-stress-strain-properties-7\\\"\u003e\u003cw:r\u003e\u003cw:t\u003etoughness\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8054,"title":"Stress-Strain Properties - 7","description":"The toughness of a material is technically defined as the plastic strain energy absorbed by the material (the plastic region in the figure below). Practically speaking, it's a measure of how much deformation a material can undergo (or energy it can absorb) before failure.\r\n\r\nWrite a function to calculate the toughness of a material—the absorbed strain energy minus the resilience. This can be accomplished by combining the code written in problem 2 (resilience) and problem 6 (absorbed strain energy). Also, return the fraction of absorbed strain energy that the toughness represents.\r\nPrevious problem: 6 - absorbed strain energy. Next problem: 8 - material properties list.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440001px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 499px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 249.5px; transform-origin: 332px 249.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 31.5px; text-align: left; transform-origin: 309px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe toughness of a material is technically defined as the plastic strain energy absorbed by the material (the plastic region in the figure below). Practically speaking, it's a measure of how much deformation a material can undergo (or energy it can absorb) before failure.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 304px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 152px; text-align: center; transform-origin: 309px 152px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline\" src=\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 42px; text-align: left; transform-origin: 309px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWrite a function to calculate the toughness of a material—the absorbed strain energy minus the resilience. This can be accomplished by combining the code written in\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/8049-stress-strain-properties-2\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eproblem 2\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e (resilience) and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eproblem 6\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e (absorbed strain energy). Also, return the fraction of absorbed strain energy that the toughness represents.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: left; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ePrevious problem: 6 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eabsorbed strain energy\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. Next problem: 8 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ematerial properties list\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff)\r\n\r\nT = 1;\r\n\r\nfrac = 0.5;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals, are generally\r\n% isotropic, whereas others, like composites, are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 463e6; %strain-hardening coefficient\r\nT_corr = 12.26e7;\r\nfrac_corr = 0.9987;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 974e6; %strain-hardening coefficient\r\nT_corr = 11.82e7;\r\nfrac_corr = 0.9751;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1845e6; %strain-hardening coefficient\r\nT_corr = 3.205e7;\r\nfrac_corr = 0.9067;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 325e6; %strain-hardening coefficient\r\nT_corr = 4.279e7;\r\nfrac_corr = 0.9902;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 304e6; %strain-hardening coefficient\r\nT_corr = 7.340e7;\r\nfrac_corr = 0.9997;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1870e6; %strain-hardening coefficient\r\nT_corr = 20.05e7;\r\nfrac_corr = 0.9995;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e9; %Pa\r\ndensity = 1.14; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\nT_corr = 3.473e7;\r\nfrac_corr = 0.9697;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\nT_corr = 0;\r\nfrac_corr = 0;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(isequal(T,T_corr))\r\nassert(isequal(frac,frac_corr))\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\nT_corr = 0;\r\nfrac_corr = 0;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(isequal(T,T_corr))\r\nassert(isequal(frac,frac_corr))\r\n\r\n%%\r\nfor i = 1:30\r\nind = randi(8);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 250e6; %Pa\r\n\t\te_y = 0.00125;\r\n\t\te_u = 0.35;\r\n\t\tsh_exp = 0.14; %strain-hardening exponent\r\n\t\tsh_coeff = 463e6; %strain-hardening coefficient\r\n\t\tT_corr = 12.26e7;\r\n\t\tfrac_corr = 0.9987;\r\n\t\t[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\n\t\tassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\n\t\tassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\tcase 2\r\n\t\tS_y = 830e6; %Pa\r\n\t\te_y = 0.00728;\r\n\t\te_u = 0.14;\r\n\t\tsh_exp = 0.04; %strain-hardening exponent\r\n\t\tsh_coeff = 974e6; %strain-hardening coefficient\r\n\t\tT_corr = 11.82e7;\r\n\t\tfrac_corr = 0.9751;\r\n\t\t[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\n\t\tassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\n\t\tassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\tcase 3\r\n\t\tS_y = 230e6; %Pa\r\n\t\te_y = 0.016;\r\n\t\te_u = 0.016;\r\n\t\tsh_exp = 0; %strain-hardening exponent\r\n\t\tsh_coeff = 0; %strain-hardening coefficient\r\n\t\tT_corr = 0;\r\n\t\tfrac_corr = 0;\r\n\t\t[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\n\t\tassert(isequal(T,T_corr))\r\n\t\tassert(isequal(frac,frac_corr))\r\n\tcase 4\r\n\t\tS_y = 317e6; %Pa\r\n\t\te_y = 0.000685;\r\n\t\te_u = 0.24;\r\n\t\tsh_exp = 0.353; %strain-hardening exponent\r\n\t\tsh_coeff = 1870e6; %strain-hardening coefficient\r\n\t\tT_corr = 20.05e7;\r\n\t\tfrac_corr = 0.9995;\r\n\t\t[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\n\t\tassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\n\t\tassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\tcase 5\r\n\t\tS_y = 70e6; %Pa\r\n\t\te_y = 0.00054;\r\n\t\te_u = 0.48;\r\n\t\tsh_exp = 0.44; %strain-hardening exponent\r\n\t\tsh_coeff = 304e6; %strain-hardening coefficient\r\n\t\tT_corr = 7.340e7;\r\n\t\tfrac_corr = 0.9997;\r\n\tcase 6\r\n\t\tS_y = 1172e6; %Pa\r\n\t\te_y = 0.00563;\r\n\t\te_u = 0.027;\r\n\t\tsh_exp = 0.075; %strain-hardening exponent\r\n\t\tsh_coeff = 1845e6; %strain-hardening coefficient\r\n\t\tT_corr = 3.205e7;\r\n\t\tfrac_corr = 0.9067;\r\n\tcase 7\r\n\t\tS_y = 82e6; %Pa\r\n\t\te_y = 0.0265;\r\n\t\te_u = 0.45;\r\n\t\tsh_exp = 0; %strain-hardening exponent\r\n\t\tsh_coeff = 0; %strain-hardening coefficient\r\n\t\tT_corr = 3.473e7;\r\n\t\tfrac_corr = 0.9697;\r\n\tcase 8\r\n\t\tS_y = 241e6; %Pa\r\n\t\te_y = 0.0035;\r\n\t\te_u = 0.15;\r\n\t\tsh_exp = 0.042; %strain-hardening exponent\r\n\t\tsh_coeff = 325e6; %strain-hardening coefficient\r\n\t\tT_corr = 4.279e7;\r\n\t\tfrac_corr = 0.9902;\r\nend\r\nend % for i = 1:30\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":26769,"edited_by":26769,"edited_at":"2024-03-27T17:44:32.000Z","deleted_by":null,"deleted_at":null,"solvers_count":88,"test_suite_updated_at":"2021-08-03T17:04:10.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T22:03:11.000Z","updated_at":"2026-02-19T09:46:19.000Z","published_at":"2015-03-30T22:03:11.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe toughness of a material is technically defined as the plastic strain energy absorbed by the material (the plastic region in the figure below). Practically speaking, it's a measure of how much deformation a material can undergo (or energy it can absorb) before failure.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"298\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"420\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to calculate the toughness of a material—the absorbed strain energy minus the resilience. This can be accomplished by combining the code written in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/8049-stress-strain-properties-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eproblem 2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (resilience) and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eproblem 6\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (absorbed strain energy). Also, return the fraction of absorbed strain energy that the toughness represents.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 6 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eabsorbed strain energy\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 8 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ematerial properties list\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"contentType\":\"image/net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"content\":\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":8053,"title":"Stress-Strain Properties - 6","description":"The total energy absorbed by a material up to failure in a tensile test is termed the absorbed strain energy. With respect to the figure below, it is the total area of the elastic and plastic regions and can be calculated by integrating the stress-strain curve. As a first approximation, many stress-strain responses can be approximated by:\r\n\r\nwhere K is a strength coefficient, eps_p is the plastic strain, and n is the hardening exponent. Stress as a function of strain can be calculated by creating a strain vector from zero to the ultimate strain and integrating the stress values in that vector.\r\n\r\n(from quora.com)\r\nWrite a function to return the absorbed strain energy for a material provided K and n. If the material does not strain harden, then K and n will be set equal to zero. In these cases, the absorbed strain energy is equal to the resilience (triangular area up to yield point) and any absorbed plastic energy, if applicable, which can be approximated by a rectangle from the yield point to the failure point with those stresses being equal. If the ultimate strain equals the yield strain, that rectangular area is zero.\r\nPrevious problem: 5 - stiffness-to-weight ratio. Next problem: 7 - toughness.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440001px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 702px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 351px; transform-origin: 332px 351px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 42px; text-align: left; transform-origin: 309px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe total energy absorbed by a material up to failure in a tensile test is termed the absorbed strain energy. With respect to the figure below, it is the total area of the elastic and plastic regions and can be calculated by integrating the stress-strain curve. As a first approximation, many stress-strain responses can be approximated by:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 29px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 14.5px; text-align: center; transform-origin: 309px 14.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" width=\"73\" height=\"23\" style=\"vertical-align: baseline;width: 73px;height: 23px\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAXBAMAAAC12X9oAAAAMFBMVEX///8WFhZQUFBAQEAwMDBiYmLm5uZ0dHTMzMyKiooMDAyenp4EBAQiIiK2trYAAAARmbiRAAAAAXRSTlMAQObYZgAAAU9JREFUeNpjZiAAUsUCn31gwipV+8ebgfv/PRBTO7b7AgN2VRP/bmX4fVMJxCzz5tuAQ9X3vwwM9zXATOYHXxpwqOJYxcB5GsL81fD/KA4n8xswRECZLA1M0QzMDHw3JjQ4LkBV9YJR9d8FEGPrnccH/l8G2rhmZ8NzB6CAoSAIgOUYCu49CgDRDw+egmhj+8fAG4Buo9dsfpBGtpNQPtM/IwaGC+iqGp5+2Qak/l2HqeLewPC3AN2Lug2sf4A0d7FxA0SkH4gSGFDdxf6DgUEG5NUJMI8C8eJzINZ5MN8ARPw9wcDQ/LGA4S/cdMYGTgxn8QCdzi8ANNMAKsDM9sU8F00Rs8SU/9dczyVN+BtrW8q7nH35BEZCKWeCZCoTjpSDBArE/05gIKiKW+D7BAaCNjLJeX1bQEgRA6+6BQNhwAM2kJCqq8SoYvu5AUgCAMD/X3IO0icRAAAAAElFTkSuQmCC\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 31.5px; text-align: left; transform-origin: 309px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ewhere K is a strength coefficient, eps_p is the plastic strain, and n is the hardening exponent. Stress as a function of strain can be calculated by creating a strain vector from zero to the ultimate strain and integrating the stress values in that vector.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 304px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 152px; text-align: center; transform-origin: 309px 152px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline\" src=\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: center; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e(from quora.com)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 126px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 63px; text-align: left; transform-origin: 309px 63px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWrite a function to return the absorbed strain energy for a material provided K and n. If the material does not strain harden, then K and n will be set equal to zero. In these cases, the absorbed strain energy is equal to the resilience (triangular area up to yield point) and any absorbed plastic energy, if applicable, which can be approximated by a rectangle from the yield point to the failure point with those stresses being equal. If the ultimate strain equals the yield strain, that rectangular area is zero.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: left; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ePrevious problem: 5 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003estiffness-to-weight ratio\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. Next problem: 7 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003etoughness\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [ASE] = stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)\r\n\r\nASE = 1;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 463e6; %strain-hardening coefficient\r\nASE_corr = 12.28e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 974e6; %strain-hardening coefficient\r\nASE_corr = 12.12e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1845e6; %strain-hardening coefficient\r\nASE_corr = 3.535e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 325e6; %strain-hardening coefficient\r\nASE_corr = 4.321e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 304e6; %strain-hardening coefficient\r\nASE_corr = 7.342e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1870e6; %strain-hardening coefficient\r\nASE_corr = 20.06e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e9; %Pa\r\ndensity = 1.14; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\nASE_corr = 3.581e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\nASE_corr = 0.184e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\nASE_corr = 0.06e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 250e6; %Pa\r\n\t\te_y = 0.00125;\r\n\t\te_u = 0.35;\r\n\t\tsh_exp = 0.14; %strain-hardening exponent\r\n\t\tsh_coeff = 463e6; %strain-hardening coefficient\r\n\t\tASE_corr = 12.28e7;\r\n\tcase 2\r\n\t\tS_y = 82e6; %Pa\r\n\t\te_y = 0.0265;\r\n\t\te_u = 0.45;\r\n\t\tsh_exp = 0; %strain-hardening exponent\r\n\t\tsh_coeff = 0; %strain-hardening coefficient\r\n\t\tASE_corr = 3.581e7;\r\n\tcase 3\r\n\t\tS_y = 241e6; %Pa\r\n\t\te_y = 0.0035;\r\n\t\te_u = 0.15;\r\n\t\tsh_exp = 0.042; %strain-hardening exponent\r\n\t\tsh_coeff = 325e6; %strain-hardening coefficient\r\n\t\tASE_corr = 4.321e7;\r\n\tcase 4\r\n\t\tS_y = 317e6; %Pa\r\n\t\te_y = 0.000685;\r\n\t\te_u = 0.24;\r\n\t\tsh_exp = 0.353; %strain-hardening exponent\r\n\t\tsh_coeff = 1870e6; %strain-hardening coefficient\r\n\t\tASE_corr = 20.06e7;\r\nend\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 830e6; %Pa\r\n\t\te_y = 0.00728;\r\n\t\te_u = 0.14;\r\n\t\tsh_exp = 0.04; %strain-hardening exponent\r\n\t\tsh_coeff = 974e6; %strain-hardening coefficient\r\n\t\tASE_corr = 12.12e7;\r\n\tcase 2\r\n\t\tS_y = 241e6; %Pa\r\n\t\te_y = 0.0035;\r\n\t\te_u = 0.15;\r\n\t\tsh_exp = 0.042; %strain-hardening exponent\r\n\t\tsh_coeff = 325e6; %strain-hardening coefficient\r\n\t\tASE_corr = 4.321e7;\r\n\tcase 3\r\n\t\tS_y = 250e6; %Pa\r\n\t\te_y = 0.00125;\r\n\t\te_u = 0.35;\r\n\t\tsh_exp = 0.14; %strain-hardening exponent\r\n\t\tsh_coeff = 463e6; %strain-hardening coefficient\r\n\t\tASE_corr = 12.28e7;\r\n\tcase 4\r\n\t\tS_y = 70e6; %Pa\r\n\t\te_y = 0.00054;\r\n\t\te_u = 0.48;\r\n\t\tsh_exp = 0.44; %strain-hardening exponent\r\n\t\tsh_coeff = 304e6; %strain-hardening coefficient\r\n\t\tASE_corr = 7.342e7;\r\nend\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 1200e6; %Pa\r\n\t\te_y = 0.001;\r\n\t\te_u = 0.001;\r\n\t\tsh_exp = 0; %strain-hardening exponent\r\n\t\tsh_coeff = 0; %strain-hardening coefficient\r\n\t\tASE_corr = 0.06e7;\r\n\tcase 2\r\n\t\tS_y = 250e6; %Pa\r\n\t\te_y = 0.00125;\r\n\t\te_u = 0.35;\r\n\t\tsh_exp = 0.14; %strain-hardening exponent\r\n\t\tsh_coeff = 463e6; %strain-hardening coefficient\r\n\t\tASE_corr = 12.28e7;\r\n\tcase 3\r\n\t\tS_y = 230e6; %Pa\r\n\t\te_y = 0.016;\r\n\t\te_u = 0.016;\r\n\t\tsh_exp = 0; %strain-hardening exponent\r\n\t\tsh_coeff = 0; %strain-hardening coefficient\r\n\t\tASE_corr = 0.184e7;\r\n\tcase 4\r\n\t\tS_y = 1172e6; %Pa\r\n\t\te_y = 0.00563;\r\n\t\te_u = 0.027;\r\n\t\tsh_exp = 0.075; %strain-hardening exponent\r\n\t\tsh_coeff = 1845e6; %strain-hardening coefficient\r\n\t\tASE_corr = 3.535e7;\r\nend\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":7,"created_by":26769,"edited_by":26769,"edited_at":"2024-03-27T17:39:31.000Z","deleted_by":null,"deleted_at":null,"solvers_count":92,"test_suite_updated_at":"2015-03-30T21:25:46.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T20:58:35.000Z","updated_at":"2026-02-19T09:44:40.000Z","published_at":"2015-03-30T21:25:46.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe total energy absorbed by a material up to failure in a tensile test is termed the absorbed strain energy. With respect to the figure below, it is the total area of the elastic and plastic regions and can be calculated by integrating the stress-strain curve. As a first approximation, many stress-strain responses can be approximated by:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"23\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"73\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ewhere K is a strength coefficient, eps_p is the plastic strain, and n is the hardening exponent. Stress as a function of strain can be calculated by creating a strain vector from zero to the ultimate strain and integrating the stress values in that vector.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"298\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"420\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(from quora.com)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to return the absorbed strain energy for a material provided K and n. If the material does not strain harden, then K and n will be set equal to zero. In these cases, the absorbed strain energy is equal to the resilience (triangular area up to yield point) and any absorbed plastic energy, if applicable, which can be approximated by a rectangle from the yield point to the failure point with those stresses being equal. If the ultimate strain equals the yield strain, that rectangular area is zero.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 5 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estiffness-to-weight ratio\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 7 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003etoughness\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.png\",\"relationshipId\":\"rId1\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationshipId\":\"rId2\"}]},{\"partUri\":\"/media/image1.png\",\"contentType\":\"image/png\",\"content\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAXBAMAAAC12X9oAAAAMFBMVEX///8WFhZQUFBAQEAwMDBiYmLm5uZ0dHTMzMyKiooMDAyenp4EBAQiIiK2trYAAAARmbiRAAAAAXRSTlMAQObYZgAAAU9JREFUeNpjZiAAUsUCn31gwipV+8ebgfv/PRBTO7b7AgN2VRP/bmX4fVMJxCzz5tuAQ9X3vwwM9zXATOYHXxpwqOJYxcB5GsL81fD/KA4n8xswRECZLA1M0QzMDHw3JjQ4LkBV9YJR9d8FEGPrnccH/l8G2rhmZ8NzB6CAoSAIgOUYCu49CgDRDw+egmhj+8fAG4Buo9dsfpBGtpNQPtM/IwaGC+iqGp5+2Qak/l2HqeLewPC3AN2Lug2sf4A0d7FxA0SkH4gSGFDdxf6DgUEG5NUJMI8C8eJzINZ5MN8ARPw9wcDQ/LGA4S/cdMYGTgxn8QCdzi8ANNMAKsDM9sU8F00Rs8SU/9dczyVN+BtrW8q7nH35BEZCKWeCZCoTjpSDBArE/05gIKiKW+D7BAaCNjLJeX1bQEgRA6+6BQNhwAM2kJCqq8SoYvu5AUgCAMD/X3IO0icRAAAAAElFTkSuQmCC\",\"relationship\":null},{\"partUri\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"contentType\":\"image/net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"content\":\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":47128,"title":"Test","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 41.6px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 20.8px; transform-origin: 407px 20.8px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 20.8px; text-align: left; transform-origin: 384px 20.8px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ein a given test, a correct answer scores 3 points, while a wrong answer scores -1. determine whether a person passes the test or not. C:correct, N:neutral, W:wrong, the threshhold is 50 out of 90 for a 30 questions test.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nC=20\r\nN=0\r\nW=10\r\ny_correct = 1;\r\nassert(isequal(your_fcn_name(C,N,W),y_correct))\r\n\r\n%%\r\nC=19\r\nN=1\r\nW=10\r\ny_correct = 0;\r\nassert(isequal(your_fcn_name(C,N,W),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":430136,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":59,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-29T17:39:50.000Z","updated_at":"2026-02-26T11:45:28.000Z","published_at":"2020-10-29T17:39:50.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ein a given test, a correct answer scores 3 points, while a wrong answer scores -1. determine whether a person passes the test or not. C:correct, N:neutral, W:wrong, the threshhold is 50 out of 90 for a 30 questions test.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":43691,"title":"determine if ","description":"determine if the elements of a matrix is a nan and return true","description_html":"\u003cp\u003edetermine if the elements of a matrix is a nan and return true\u003c/p\u003e","function_template":"function y = my_function(x)\r\n  y = \r\nend","test_suite":"%%\r\nx = [1 0 5 nan];\r\ny_correct = [0 0 0 1]\r\nassert(isequal(my_function(x),y_correct))\r\n%%\r\nx = [nan 1; 5 nan];\r\ny_correct = [1 0;0 1]\r\nassert(isequal(my_function(x),y_correct))\r\n%%\r\nx = [nan nan nan;nan nan nan];\r\ny_correct = [1 1 1;1 1 1]\r\nassert(isequal(my_function(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":88437,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":102,"test_suite_updated_at":"2016-11-28T02:45:31.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-11-28T02:42:32.000Z","updated_at":"2026-02-11T18:28:36.000Z","published_at":"2016-11-28T02:42:32.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003edetermine if the elements of a matrix is a nan and return true\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2115,"title":"Test","description":"Answer the question and the correct answer  write in vector. Only one answer is correct.\r\n\r\n 1a Yes\r\n 1b No\r\n 1c No\r\n 1d No\r\n\r\n 2a No\r\n 2b No\r\n 2c Yes\r\n 2d No\r\n\r\n 3a No\r\n 3b No\r\n 3c Yes\r\n 3d No\r\n\r\n 4a No\r\n 4b Yes\r\n 4c No\r\n 4d No\r\n\r\nThe answer is in the form \r\n\r\n function y = res(x)\r\n   y =  ['1a 2c 3c 4b'];\r\n end\r\n","description_html":"\u003cp\u003eAnswer the question and the correct answer  write in vector. Only one answer is correct.\u003c/p\u003e\u003cpre\u003e 1a Yes\r\n 1b No\r\n 1c No\r\n 1d No\u003c/pre\u003e\u003cpre\u003e 2a No\r\n 2b No\r\n 2c Yes\r\n 2d No\u003c/pre\u003e\u003cpre\u003e 3a No\r\n 3b No\r\n 3c Yes\r\n 3d No\u003c/pre\u003e\u003cpre\u003e 4a No\r\n 4b Yes\r\n 4c No\r\n 4d No\u003c/pre\u003e\u003cp\u003eThe answer is in the form\u003c/p\u003e\u003cpre\u003e function y = res(x)\r\n   y =  ['1a 2c 3c 4b'];\r\n end\u003c/pre\u003e","function_template":"function y = res(x)\r\n   y =  ['1a 2b 3c 4d'];\r\nend\r\n","test_suite":"%%\r\nx =  ['1a 2c 3c 4b'];\r\ny_correct =  ['1a 2c 3c 4b'];\r\nassert(isequal(res(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":21325,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":177,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-01-14T11:49:51.000Z","updated_at":"2026-02-19T15:27:48.000Z","published_at":"2014-01-14T11:50:18.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAnswer the question and the correct answer write in vector. Only one answer is correct.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 1a Yes\\n 1b No\\n 1c No\\n 1d No\\n\\n 2a No\\n 2b No\\n 2c Yes\\n 2d No\\n\\n 3a No\\n 3b No\\n 3c Yes\\n 3d No\\n\\n 4a No\\n 4b Yes\\n 4c No\\n 4d No]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe answer is in the form\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ function y = res(x)\\n   y =  ['1a 2c 3c 4b'];\\n end]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43689,"title":"Make an identity matrix whose diagonal elements are 1:n","description":"For a given input n, make an n by n identity matrix that contains the elements 1:n along its diagonal. For example, if input=5:\r\n\r\n output = [1 0 0 0 0;\r\n           0 2 0 0 0;\r\n           0 0 3 0 0;\r\n           0 0 0 4 0;\r\n           0 0 0 0 5]\r\n","description_html":"\u003cp\u003eFor a given input n, make an n by n identity matrix that contains the elements 1:n along its diagonal. For example, if input=5:\u003c/p\u003e\u003cpre\u003e output = [1 0 0 0 0;\r\n           0 2 0 0 0;\r\n           0 0 3 0 0;\r\n           0 0 0 4 0;\r\n           0 0 0 0 5]\u003c/pre\u003e","function_template":"function y = special_eye(n)\r\n  y = n\r\nend","test_suite":"%%\r\nn = 1;\r\ny_correct = 1;\r\nassert(isequal(special_eye(n),y_correct))\r\n%%\r\nn = 2;\r\ny_correct = [1 0;0 2]\r\nassert(isequal(special_eye(n),y_correct))\r\n%%\r\nn = 3;\r\ny_correct = [1 0 0;0 2 0;0 0 3]\r\nassert(isequal(special_eye(n),y_correct))\r\n%%\r\nn = 4;\r\ny_correct = [1 0 0 0;0 2 0 0;0 0 3 0;0 0 0 4]\r\nassert(isequal(special_eye(n),y_correct))\r\n%%\r\nn = 5;\r\ny_correct = [1 0 0 0 0;0 2 0 0 0;0 0 3 0 0; 0 0 0 4 0; 0 0 0 0 5]\r\nassert(isequal(special_eye(n),y_correct))\r\n%%\r\nn = 6;\r\ny_correct = [1 0 0 0 0 0;0 2 0 0 0 0;0 0 3 0 0 0; 0 0 0 4 0 0; 0 0 0 0 5 0; 0 0 0 0 0 6]\r\nassert(isequal(special_eye(n),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":88437,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":123,"test_suite_updated_at":"2016-12-21T21:19:59.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-11-28T02:38:35.000Z","updated_at":"2026-02-10T22:03:12.000Z","published_at":"2016-11-28T02:38:35.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor a given input n, make an n by n identity matrix that contains the elements 1:n along its diagonal. For example, if input=5:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ output = [1 0 0 0 0;\\n           0 2 0 0 0;\\n           0 0 3 0 0;\\n           0 0 0 4 0;\\n           0 0 0 0 5]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":58269,"title":"factorial_calc(n)","description":"Write a MATLAB function called factorial_calc(n) that takes a positive integer n as input and calculates the factorial of n. The factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example, 5! is calculated as 5 * 4 * 3 * 2 * 1 and equals 120.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 63px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 31.5px; transform-origin: 407px 31.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWrite a MATLAB function called \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003efactorial_calc(n)\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e that takes a positive integer \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003en\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e as input and calculates the factorial of \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003en\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. The factorial of a non-negative integer \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003en\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e, denoted by \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003en!\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e, is the product of all positive integers less than or equal to \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003en\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. For example, \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e5!\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e is calculated as \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e5 * 4 * 3 * 2 * 1\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e and equals 120.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function result = factorial_calc(n)\r\n  \r\nend","test_suite":"%%\r\nn = 5;\r\nfactorial_result = factorial_calc(n);\r\nfprintf(\"The factorial of %d is %d.\\n\", n, factorial_result);","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":3104740,"edited_by":3104740,"edited_at":"2023-05-06T17:28:54.000Z","deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-05-06T17:28:13.000Z","updated_at":"2026-04-03T13:12:30.000Z","published_at":"2023-05-06T17:28:54.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a MATLAB function called \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efactorial_calc(n)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e that takes a positive integer \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e as input and calculates the factorial of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. The factorial of a non-negative integer \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, denoted by \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en!\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, is the product of all positive integers less than or equal to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003en\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. For example, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e5!\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is calculated as \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e5 * 4 * 3 * 2 * 1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and equals 120.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2118,"title":"Test of Quiz","description":"Answer the questions and  write in vector. Only one answer is correct.\r\n\r\nThe founder of fuzzy logic is\r\n\r\n 1a) D. Golberg\r\n 1b) L. Zadeh\r\n 1c) J. Holland\r\n 1d) W. Pitts\r\n\r\nOne of the founders of the artificial neuron model is:\r\n\r\n 2a) W. McCulloch \r\n 2b) R.Williams\r\n 2c) G. Hinton\r\n 2d) P. Man\r\n\r\nThe founder of genetic algorithm is:\r\n\r\n 3a) A. Murphy\r\n 3b) T. Blair\r\n 3c) A. Clifford\r\n 3d) J. Holland\r\n\r\nThe founder of fractals is:\r\n\r\n 4a) A. Einstein\r\n 4b) L. Zadeh\r\n 4c) B. Mandelbrott\r\n 4d) J. Heyrovský\r\n\r\nThe answer is in the form \r\n\r\n function y = res(x)\r\n   y =  ['1a 2b 3c 4d'];\r\n end\r\n","description_html":"\u003cp\u003eAnswer the questions and  write in vector. Only one answer is correct.\u003c/p\u003e\u003cp\u003eThe founder of fuzzy logic is\u003c/p\u003e\u003cpre\u003e 1a) D. Golberg\r\n 1b) L. Zadeh\r\n 1c) J. Holland\r\n 1d) W. Pitts\u003c/pre\u003e\u003cp\u003eOne of the founders of the artificial neuron model is:\u003c/p\u003e\u003cpre\u003e 2a) W. McCulloch \r\n 2b) R.Williams\r\n 2c) G. Hinton\r\n 2d) P. Man\u003c/pre\u003e\u003cp\u003eThe founder of genetic algorithm is:\u003c/p\u003e\u003cpre\u003e 3a) A. Murphy\r\n 3b) T. Blair\r\n 3c) A. Clifford\r\n 3d) J. Holland\u003c/pre\u003e\u003cp\u003eThe founder of fractals is:\u003c/p\u003e\u003cpre\u003e 4a) A. Einstein\r\n 4b) L. Zadeh\r\n 4c) B. Mandelbrott\r\n 4d) J. Heyrovský\u003c/pre\u003e\u003cp\u003eThe answer is in the form\u003c/p\u003e\u003cpre\u003e function y = res(x)\r\n   y =  ['1a 2b 3c 4d'];\r\n end\u003c/pre\u003e","function_template":"function y = res(x)\r\n  y = x;\r\nend\r\n","test_suite":"%%\r\nx =  ['1b 2c 3d 4c'];\r\ny_correct =  ['1b 2c 3d 4c'];\r\nassert(isequal(res(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":21325,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":191,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-01-14T13:47:25.000Z","updated_at":"2026-02-09T18:04:45.000Z","published_at":"2014-01-14T13:47:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAnswer the questions and write in vector. Only one answer is correct.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe founder of fuzzy logic is\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 1a) D. Golberg\\n 1b) L. Zadeh\\n 1c) J. Holland\\n 1d) W. Pitts]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOne of the founders of the artificial neuron model is:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 2a) W. McCulloch \\n 2b) R.Williams\\n 2c) G. Hinton\\n 2d) P. Man]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe founder of genetic algorithm is:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 3a) A. Murphy\\n 3b) T. Blair\\n 3c) A. Clifford\\n 3d) J. Holland]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe founder of fractals is:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 4a) A. Einstein\\n 4b) L. Zadeh\\n 4c) B. Mandelbrott\\n 4d) J. Heyrovský]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe answer is in the form\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ function y = res(x)\\n   y =  ['1a 2b 3c 4d'];\\n end]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":46711,"title":"Test - Add sequence of numbers with given start, step, and end","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 141px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 70.5px; transform-origin: 407px 70.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eTest problem (to learn how to create problems)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eGiven i = initial value\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e          n = step value\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e          e = end value\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eFind the sum of the generated sequence\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function s = sum_seq(i,n,e)\r\n  s = 0;\r\nend","test_suite":"%%\r\ni=3\r\nn=3\r\ne=90\r\ny_correct = 1395;\r\nassert(isequal(sum_seq(i,n,e),y_correct))\r\n\r\n%%\r\n\r\ni=-10\r\nn=1.5\r\ne=200\r\ny_correct = 13395;\r\nassert(isequal(sum_seq(i,n,e),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":417672,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":50,"test_suite_updated_at":"2020-10-09T01:21:01.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-09T01:19:51.000Z","updated_at":"2026-02-16T16:16:33.000Z","published_at":"2020-10-09T01:19:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eTest problem (to learn how to create problems)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven i = initial value\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e          n = step value\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e          e = end value\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the sum of the generated sequence\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":43694,"title":"find the 'M'","description":"for an input x, return 1 at the location of the letter 'M'","description_html":"\u003cp\u003efor an input x, return 1 at the location of the letter 'M'\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y=\r\nend","test_suite":"%%\r\nx = [1 5;'M' 7];\r\ny_correct = [0 0;1 0]\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = ['M' 7  7;1 'M' 6; 5 8 'M'];\r\ny_correct = [1 0 0;0 1 0;0 0 1]\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":88437,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":73,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-11-28T03:05:12.000Z","updated_at":"2026-02-18T09:30:35.000Z","published_at":"2016-11-28T03:05:12.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003efor an input x, return 1 at the location of the letter 'M'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1375,"title":"select the primes of a vector","description":"Find the prime numbers in a vector","description_html":"\u003cp\u003eFind the prime numbers in a vector\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [1 2 3 4 5 31 67];\r\ny_correct = [2 3 5 31 67];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":12098,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":321,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-03-22T16:30:19.000Z","updated_at":"2026-02-17T14:58:03.000Z","published_at":"2013-03-22T16:30:19.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFind the prime numbers in a vector\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8048,"title":"Stress-Strain Properties - 1","description":"This is the first in a series of problems regarding mechanics of materials, in particular, material properties drawn from stress-strain responses. A simplified typical stress-strain response is illustrated below (from quora.com):\r\n\r\nThe yield stress is the pressure required to start deformation of the material being tested. The yield point is the point along the response indicated by the yield stress (vertical axis) and the yield strain (horizontal axis). The response of the material up to this point is elastic, meaning that all deformation is reversible. The elastic modulus (E, also known as modulus of elasticity or Young's modulus) is the slope of this line. Write a function to calculate the elastic modulus for a material, provided the elastic strain and yield stress (yield point).\r\nNext problem: 2 - resilience.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440001px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 541px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 270.5px; transform-origin: 332px 270.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 31.5px; text-align: left; transform-origin: 309px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThis is the first in a series of problems regarding mechanics of materials, in particular, material properties drawn from stress-strain responses. A simplified typical stress-strain response is illustrated below (from\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e quora.com):\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 304px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 152px; text-align: center; transform-origin: 309px 152px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline\" src=\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 126px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 63px; text-align: left; transform-origin: 309px 63px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe yield stress is the pressure required to start deformation of the material being tested. The yield point is the point along the response indicated by the yield stress (vertical axis) and the yield strain (horizontal axis). The response of the material up to this point is elastic, meaning that all deformation is reversible. The elastic modulus (E, also known as modulus of elasticity or Young's modulus) is the slope of this line. Write a function to calculate the elastic modulus for a material, provided the elastic strain and yield stress (yield point).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: left; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eNext problem: 2 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/8049-stress-strain-properties-2\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eresilience\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [E] = stress_strain1(S_y,e_y)\r\n\r\nE = 1;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile \r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient 530MPa\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e9; %Pa\r\ndensity = 1.14; %g/cm^3\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nassert(abs(stress_strain1(S_y,e_y)-E)\u003c1e9)\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":26769,"edited_by":26769,"edited_at":"2024-03-27T17:40:39.000Z","deleted_by":null,"deleted_at":null,"solvers_count":324,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T18:09:31.000Z","updated_at":"2026-03-31T10:50:52.000Z","published_at":"2015-03-30T18:09:58.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the first in a series of problems regarding mechanics of materials, in particular, material properties drawn from stress-strain responses. A simplified typical stress-strain response is illustrated below (from\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e quora.com):\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe yield stress is the pressure required to start deformation of the material being tested. The yield point is the point along the response indicated by the yield stress (vertical axis) and the yield strain (horizontal axis). The response of the material up to this point is elastic, meaning that all deformation is reversible. The elastic modulus (E, also known as modulus of elasticity or Young's modulus) is the slope of this line. Write a function to calculate the elastic modulus for a material, provided the elastic strain and yield stress (yield point).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eNext problem: 2 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/8049-stress-strain-properties-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eresilience\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"contentType\":\"image/net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"content\":\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2,"title":"Make the vector [1 2 3 4 5 6 7 8 9 10]","description":"In MATLAB, you create a vector by enclosing the elements in square brackets like so:\r\n\r\n x = [1 2 3 4]\r\n\r\nCommas are optional, so you can also type\r\n\r\n x = [1, 2, 3, 4]\r\n\r\nCreate the vector\r\n\r\n x = [1 2 3 4 5 6 7 8 9 10]\r\n\r\nThere's a faster way to do it using MATLAB's \u003chttp://www.mathworks.com/help/techdoc/ref/colon.html colon notation\u003e.","description_html":"\u003cp\u003eIn MATLAB, you create a vector by enclosing the elements in square brackets like so:\u003c/p\u003e\u003cpre\u003e x = [1 2 3 4]\u003c/pre\u003e\u003cp\u003eCommas are optional, so you can also type\u003c/p\u003e\u003cpre\u003e x = [1, 2, 3, 4]\u003c/pre\u003e\u003cp\u003eCreate the vector\u003c/p\u003e\u003cpre\u003e x = [1 2 3 4 5 6 7 8 9 10]\u003c/pre\u003e\u003cp\u003eThere's a faster way to do it using MATLAB's \u003ca href = \"http://www.mathworks.com/help/techdoc/ref/colon.html\"\u003ecolon notation\u003c/a\u003e.\u003c/p\u003e","function_template":"function x = oneToTen\r\n  x = 0;\r\nend","test_suite":"%%\r\nx_correct = [1 2 3 4 5 6 7 8 9 10];\r\nassert(isequal(oneToTen,x_correct))","published":true,"deleted":false,"likes_count":224,"comments_count":56,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":52929,"test_suite_updated_at":"2012-01-18T01:00:17.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:17.000Z","updated_at":"2026-04-05T10:28:15.000Z","published_at":"2012-01-18T01:00:17.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn MATLAB, you create a vector by enclosing the elements in square brackets like so:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [1 2 3 4]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCommas are optional, so you can also type\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [1, 2, 3, 4]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCreate the vector\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ x = [1 2 3 4 5 6 7 8 9 10]]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere's a faster way to do it using MATLAB's\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/help/techdoc/ref/colon.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ecolon notation\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8051,"title":"Stress-Strain Properties - 4","description":"A common measure of the ability of a material to carry load per unit mass is termed strength-to-weight ratio and is calculated by dividing the ultimate tensile strength of the material by its density. This property is key in weight-critical applications, such as aerospace, where many materials with high strength-to-weight ratios are used (e.g., Ni-based superalloys, Ti-based alloys, Al-based alloys, and composites).\r\n\r\nWrite a function to calculate the strength-to-weight ratio for a given material provided its ultimate tensile strength and density.\r\n\r\nPrevious problem: 3 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8050-stress-strain-properties-3 qualitative measure of brittleness\u003e. Next problem: 5 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8052-stress-strain-properties-5 stiffness-to-weight ratio\u003e.","description_html":"\u003cp\u003eA common measure of the ability of a material to carry load per unit mass is termed strength-to-weight ratio and is calculated by dividing the ultimate tensile strength of the material by its density. This property is key in weight-critical applications, such as aerospace, where many materials with high strength-to-weight ratios are used (e.g., Ni-based superalloys, Ti-based alloys, Al-based alloys, and composites).\u003c/p\u003e\u003cp\u003eWrite a function to calculate the strength-to-weight ratio for a given material provided its ultimate tensile strength and density.\u003c/p\u003e\u003cp\u003ePrevious problem: 3 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8050-stress-strain-properties-3\"\u003equalitative measure of brittleness\u003c/a\u003e. Next problem: 5 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8052-stress-strain-properties-5\"\u003estiffness-to-weight ratio\u003c/a\u003e.\u003c/p\u003e","function_template":"function [StWR] = stress_strain4(S_u,density)\r\n\r\nStWR = 1;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nStWR_corr = 5.096e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nStWR_corr = 19.96e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nStWR_corr = 17.18e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nStWR_corr = 11.11e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient\r\nStWR_corr = 2.466e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nStWR_corr = 5.376e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e-2; %Pa\r\ndensity = 1.14; %g/cm^3\r\nStWR_corr = 7.193e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nStWR_corr = 15.23e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nStWR_corr = 34.19e7;\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_u = 400e6; %Pa\r\n\t\tdensity = 7.85; %g/cm^3\r\n\t\tStWR_corr = 5.096e7;\r\n\tcase 2\r\n\t\tS_u = 230e6; %Pa\r\n\t\tdensity = 1.51; %g/cm^3\r\n\t\tStWR_corr = 15.23e7;\r\n\tcase 3\r\n\t\tS_u = 1130e6; %Pa\r\n\t\tdensity = 21.02; %g/cm^3\r\n\t\tStWR_corr = 5.376e7;\r\n\tcase 4\r\n\t\tS_u = 1200e6; %Pa\r\n\t\tdensity = 3.51; %g/cm^3\r\n\t\tStWR_corr = 34.19e7;\r\nend\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_u = 300e6; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tStWR_corr = 11.11e7;\r\n\tcase 2\r\n\t\tS_u = 900e6; %Pa\r\n\t\tdensity = 4.51; %g/cm^3\r\n\t\tStWR_corr = 19.96e7;\r\n\tcase 3\r\n\t\tS_u = 220e6; %Pa\r\n\t\tdensity = 8.92; %g/cm^3\r\n\t\tStWR_corr = 2.466e7;\r\n\tcase 4\r\n\t\tS_u = 230e6; %Pa\r\n\t\tdensity = 1.51; %g/cm^3\r\n\t\tStWR_corr = 15.23e7;\r\nend\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_u = 300e6; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tStWR_corr = 11.11e7;\r\n\tcase 2\r\n\t\tS_u = 1200e6; %Pa\r\n\t\tdensity = 3.51; %g/cm^3\r\n\t\tStWR_corr = 34.19e7;\r\n\tcase 3\r\n\t\tS_u = 82e6; %Pa\r\n\t\tdensity = 1.14; %g/cm^3\r\n\t\tStWR_corr = 7.193e7;\r\n\tcase 4\r\n\t\tS_u = 900e6; %Pa\r\n\t\tdensity = 4.51; %g/cm^3\r\n\t\tStWR_corr = 19.96e7;\r\nend\r\nassert(abs(stress_strain4(S_u,density)-StWR_corr)/StWR_corr\u003c1e-2)\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":222,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T19:24:41.000Z","updated_at":"2026-03-10T20:20:32.000Z","published_at":"2015-03-30T19:24:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA common measure of the ability of a material to carry load per unit mass is termed strength-to-weight ratio and is calculated by dividing the ultimate tensile strength of the material by its density. This property is key in weight-critical applications, such as aerospace, where many materials with high strength-to-weight ratios are used (e.g., Ni-based superalloys, Ti-based alloys, Al-based alloys, and composites).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to calculate the strength-to-weight ratio for a given material provided its ultimate tensile strength and density.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 3 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8050-stress-strain-properties-3\\\"\u003e\u003cw:r\u003e\u003cw:t\u003equalitative measure of brittleness\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 5 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8052-stress-strain-properties-5\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estiffness-to-weight ratio\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8052,"title":"Stress-Strain Properties - 5","description":"Similar to the previous problem, materials may be characterized by their stiffness-to-weight ratio, which is the elastic modulus divided by density. Write a function to calculate this ratio for a material provided its elastic modulus and density.\r\n\r\nPrevious problem: 4 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8051-stress-strain-properties-4 strength-to-weight ratio\u003e. Next problem: 6 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8053-stress-strain-properties-6 absorbed strain energy\u003e.","description_html":"\u003cp\u003eSimilar to the previous problem, materials may be characterized by their stiffness-to-weight ratio, which is the elastic modulus divided by density. Write a function to calculate this ratio for a material provided its elastic modulus and density.\u003c/p\u003e\u003cp\u003ePrevious problem: 4 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8051-stress-strain-properties-4\"\u003estrength-to-weight ratio\u003c/a\u003e. Next problem: 6 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8053-stress-strain-properties-6\"\u003eabsorbed strain energy\u003c/a\u003e.\u003c/p\u003e","function_template":"function [EtWR] = stress_strain5(E,density)\r\n\r\nEtWR = 1\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nEtWR_corr = 2.548e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nEtWR_corr = 2.528e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nEtWR_corr = 2.540e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nEtWR_corr = 2.552e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient\r\nEtWR_corr = 1.457e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nEtWR_corr = 2.203e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e9; %Pa\r\ndensity = 1.14; %g/cm^3\r\nEtWR_corr = 0.272e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nEtWR_corr = 0.960e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nEtWR_corr = 34.19e10;\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tE = 114e9; %Pa\r\n\t\tdensity = 4.51; %g/cm^3\r\n\t\tEtWR_corr = 2.528e10;\r\n\tcase 2\r\n\t\tE = 68.9e9; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tEtWR_corr = 2.552e10;\r\n\tcase 3\r\n\t\tE = 200e9; %Pa\r\n\t\tdensity = 7.85; %g/cm^3\r\n\t\tEtWR_corr = 2.548e10;\r\n\tcase 4\r\n\t\tE = 1200e9; %Pa\r\n\t\tdensity = 3.51; %g/cm^3\r\n\t\tEtWR_corr = 34.19e10;\r\nend\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tE = 68.9e9; %Pa\r\n\t\tdensity = 2.7; %g/cm^3\r\n\t\tEtWR_corr = 2.552e10;\r\n\tcase 2\r\n\t\tE = 3.1e9; %Pa\r\n\t\tdensity = 1.14; %g/cm^3\r\n\t\tEtWR_corr = 0.272e10;\r\n\tcase 3\r\n\t\tE = 14.5e9; %Pa\r\n\t\tdensity = 1.51; %g/cm^3\r\n\t\tEtWR_corr = 0.960e10;\r\n\tcase 4\r\n\t\tE = 208e9; %Pa\r\n\t\tdensity = 8.19; %g/cm^3\r\n\t\tEtWR_corr = 2.540e10;\r\nend\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tE = 208e9; %Pa\r\n\t\tdensity = 8.19; %g/cm^3\r\n\t\tEtWR_corr = 2.540e10;\r\n\tcase 2\r\n\t\tE = 463e9; %Pa\r\n\t\tdensity = 21.02; %g/cm^3\r\n\t\tEtWR_corr = 2.203e10;\r\n\tcase 3\r\n\t\tE = 130e9; %Pa\r\n\t\tdensity = 8.92; %g/cm^3\r\n\t\tEtWR_corr = 1.457e10;\r\n\tcase 4\r\n\t\tE = 3.1e9; %Pa\r\n\t\tdensity = 1.14; %g/cm^3\r\n\t\tEtWR_corr = 0.272e10;\r\nend\r\nassert(abs(stress_strain5(E,density)-EtWR_corr)/EtWR_corr\u003c1e-2)\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":212,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T19:40:12.000Z","updated_at":"2026-03-10T20:42:38.000Z","published_at":"2015-03-30T19:40:12.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSimilar to the previous problem, materials may be characterized by their stiffness-to-weight ratio, which is the elastic modulus divided by density. Write a function to calculate this ratio for a material provided its elastic modulus and density.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 4 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8051-stress-strain-properties-4\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estrength-to-weight ratio\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 6 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8053-stress-strain-properties-6\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eabsorbed strain energy\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8049,"title":"Stress-Strain Properties - 2","description":"The resilience of a material is its ability to resist permanent (or plastic) deformation. The resilience coincides with the elastic region in the figure below and is calculated as the area under the stress-strain curve up to the yield point. Given that the elastic region is presumed to be entirely linear, this area is a triangle. Write a function to calculate the resilience of a material provided its elastic strain and yield stress (yield strength).\r\n\r\n(from quora.com)\r\nPrevious problem: 1 - elastic modulus. Next problem: 3 - qualitative measure of brittleness.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440001px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 478px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 239px; transform-origin: 332px 239px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 105px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 52.5px; text-align: left; transform-origin: 309px 52.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe resilience of a material is its ability to resist permanent (or plastic) deformation. The resilience coincides with the elastic region in the figure below and is calculated as the area under the stress-strain curve up to the yield point. Given that the elastic region is presumed to be entirely linear, this area is a triangle. Write a function to calculate the resilience of a material provided its elastic strain and yield stress (yield strength).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 304px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 152px; text-align: center; transform-origin: 309px 152px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline\" src=\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: center; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e(from quora.com)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: left; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ePrevious problem: 1 - \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/8048-stress-strain-properties-1\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eelastic modulus\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. Next problem: 3 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003equalitative measure of brittleness\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [R] = stress_strain2(S_y,e_y)\r\n\r\nR = 1;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nassert(abs(stress_strain2(S_y,e_y)-1.5625e5)/1.5625e5\u003c5e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nassert(abs(stress_strain2(S_y,e_y)-3.0212e6)/3.0212e6\u003c5e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nassert(abs(stress_strain2(S_y,e_y)-3.29918e6)/3.29918e6\u003c5e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nassert(abs(stress_strain2(S_y,e_y)-4.2175e5)/4.2175e5\u003c5e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient 530MPa\r\nassert(abs(stress_strain2(S_y,e_y)-1.89e4)/1.89e4\u003c5e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nassert(abs(stress_strain2(S_y,e_y)-1.085725e5)/1.085725e5\u003c5e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.5e-2; %Pa\r\ndensity = 1.14; %g/cm^3\r\nassert(abs(stress_strain2(S_y,e_y)-1.0865e6)/1.0865e6\u003c5e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nassert(abs(stress_strain2(S_y,e_y)-1.84e6)/1.84e6\u003c5e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nassert(abs(stress_strain2(S_y,e_y)-6e5)/6e5\u003c5e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 250e6; %Pa\r\n\t\te_y = 0.00125;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.5625e5)/1.5625e5\u003c5e-2)\r\n\tcase 2\r\n\t\tS_y = 82e6; %Pa\r\n\t\te_y = 0.0265;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.0865e6)/1.0865e6\u003c5e-2)\r\n\tcase 3\r\n\t\tS_y = 241e6; %Pa\r\n\t\te_y = 0.0035;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-4.2175e5)/4.2175e5\u003c5e-2)\r\n\tcase 4\r\n\t\tS_y = 1172e6; %Pa\r\n\t\te_y = 0.00563;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-3.29918e6)/3.29918e6\u003c5e-2)\r\nend\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 1200e6; %Pa\r\n\t\te_y = 0.001;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-6e5)/6e5\u003c5e-2)\r\n\tcase 2\r\n\t\tS_y = 1172e6; %Pa\r\n\t\te_y = 0.00563;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-3.29918e6)/3.29918e6\u003c5e-2)\r\n\tcase 3\r\n\t\tS_y = 230e6; %Pa\r\n\t\te_y = 0.016;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.84e6)/1.84e6\u003c5e-2)\r\n\tcase 4\r\n\t\tS_y = 250e6; %Pa\r\n\t\te_y = 0.00125;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.5625e5)/1.5625e5\u003c5e-2)\r\nend\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 830e6; %Pa\r\n\t\te_y = 0.00728;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-3.0212e6)/3.0212e6\u003c5e-2)\r\n\tcase 2\r\n\t\tS_y = 230e6; %Pa\r\n\t\te_y = 0.016;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.84e6)/1.84e6\u003c5e-2)\r\n\tcase 3\r\n\t\tS_y = 70e6; %Pa\r\n\t\te_y = 0.00054;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.89e4)/1.89e4\u003c5e-2)\r\n\tcase 4\r\n\t\tS_y = 317e6; %Pa\r\n\t\te_y = 0.000685;\r\n\t\tassert(abs(stress_strain2(S_y,e_y)-1.085725e5)/1.085725e5\u003c5e-2)\r\nend\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":26769,"edited_by":26769,"edited_at":"2024-03-27T17:41:09.000Z","deleted_by":null,"deleted_at":null,"solvers_count":264,"test_suite_updated_at":"2015-03-30T18:44:33.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T18:27:49.000Z","updated_at":"2026-03-31T10:53:49.000Z","published_at":"2015-03-30T18:27:49.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe resilience of a material is its ability to resist permanent (or plastic) deformation. The resilience coincides with the elastic region in the figure below and is calculated as the area under the stress-strain curve up to the yield point. Given that the elastic region is presumed to be entirely linear, this area is a triangle. Write a function to calculate the resilience of a material provided its elastic strain and yield stress (yield strength).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(from quora.com)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 1 - \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/8048-stress-strain-properties-1\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eelastic modulus\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 3 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003equalitative measure of brittleness\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"contentType\":\"image/net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"content\":\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":45206,"title":"How to find the position of an element in a vector without using the find function","description":"Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for.","description_html":"\u003cp\u003eWrite a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for.\u003c/p\u003e","function_template":"function posX=findPosition (x,y)\r\nend","test_suite":"%%\r\nx = [1 3 5 4 2];\r\ny=2;\r\n lap=5;\r\nassert(isequal(findPosition (x,y),lap))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":351145,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":43,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2019-11-18T15:07:25.000Z","updated_at":"2026-03-11T11:49:41.000Z","published_at":"2019-11-18T15:07:25.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8050,"title":"Stress-Strain Properties - 3","description":"A brittle material will not exhibit a yield point. In other words, the yield point and failure point coincide. In such cases, the yield strain and failure strain (also known as ultimate strain or elongation) are the same value. On the other hand, ductile materials have a failure strain that is significantly greater than the elastic strain, as shown in the figure below.\r\n\r\n(from quora.com)\r\nWrite a function to determine the qualitative brittleness of the material by calculating the ratio of elastic strain to failure strain. A ratio of one indicates complete brittleness, whereas a ratio close to zero indicates essentially no brittleness.\r\nPrevious problem: 2 - resilience. Next problem: 4 - strength-to-weight ratio.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440001px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 529px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 264.5px; transform-origin: 332px 264.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 42px; text-align: left; transform-origin: 309px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eA brittle material will not exhibit a yield point. In other words, the yield point and failure point coincide. In such cases, the yield strain and failure strain (also known as ultimate strain or elongation) are the same value. On the other hand, ductile materials have a failure strain that is significantly greater than the elastic strain, as shown in the figure below.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 304px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 152px; text-align: center; transform-origin: 309px 152px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline\" src=\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: center; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e(from quora.com)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 31.5px; text-align: left; transform-origin: 309px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWrite a function to determine the qualitative brittleness of the material by calculating the ratio of elastic strain to failure strain. A ratio of one indicates complete brittleness, whereas a ratio close to zero indicates essentially no brittleness.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: left; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ePrevious problem: 2 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/8049-stress-strain-properties-2\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eresilience\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. Next problem: 4 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003estrength-to-weight ratio\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [BR] = stress_strain3(e_y,e_u)\r\n\r\nBR = 1;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 0.463; %strain-hardening coefficient\r\nBR_corr = 0.003571;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 0.974; %strain-hardening coefficient\r\nBR_corr = 0.052;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1.845; %strain-hardening coefficient\r\nBR_corr = 0.2085;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 0.325; %strain-hardening coefficient\r\nBR_corr = 0.02333;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 0.304; %strain-hardening coefficient\r\nBR_corr = 0.001125;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1.870; %strain-hardening coefficient\r\nBR_corr = 0.002854;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e-2; %Pa\r\ndensity = 1.14; %g/cm^3\r\nBR_corr = 0.058889;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nBR_corr = 1.0;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nBR_corr = 1.0;\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\te_y = 0.00125;\r\n\t\te_u = 0.35;\r\n\t\tBR_corr = 0.003571;\r\n\tcase 2\r\n\t\te_y = 0.00054;\r\n\t\te_u = 0.48;\r\n\t\tBR_corr = 0.001125;\r\n\tcase 3\r\n\t\te_y = 0.0035;\r\n\t\te_u = 0.15;\r\n\t\tBR_corr = 0.02333;\r\n\tcase 4\r\n\t\te_y = 0.00054;\r\n\t\te_u = 0.48;\r\n\t\tBR_corr = 0.001125;\r\nend\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\te_y = 0.0265;\r\n\t\te_u = 0.45;\r\n\t\tBR_corr = 0.058889;\r\n\tcase 2\r\n\t\te_y = 0.00728;\r\n\t\te_u = 0.14;\r\n\t\tBR_corr = 0.052;\r\n\tcase 3\r\n\t\te_y = 0.00563;\r\n\t\te_u = 0.027;\r\n\t\tBR_corr = 0.2085;\r\n\tcase 4\r\n\t\te_y = 0.016;\r\n\t\te_u = 0.016;\r\n\t\tBR_corr = 1.0;\r\nend\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\te_y = 0.00125;\r\n\t\te_u = 0.35;\r\n\t\tBR_corr = 0.003571;\r\n\tcase 2\r\n\t\te_y = 0.00563;\r\n\t\te_u = 0.027;\r\n\t\tBR_corr = 0.2085;\r\n\tcase 3\r\n\t\te_y = 0.00728;\r\n\t\te_u = 0.14;\r\n\t\tBR_corr = 0.052;\r\n\tcase 4\r\n\t\te_y = 0.00054;\r\n\t\te_u = 0.48;\r\n\t\tBR_corr = 0.001125;\r\nend\r\nassert(abs(stress_strain3(e_y,e_u)-BR_corr)/BR_corr\u003c1e-2)\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":26769,"edited_by":26769,"edited_at":"2024-03-27T17:42:29.000Z","deleted_by":null,"deleted_at":null,"solvers_count":241,"test_suite_updated_at":"2015-03-30T18:54:51.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T18:53:23.000Z","updated_at":"2026-03-31T10:56:32.000Z","published_at":"2015-03-30T18:53:23.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA brittle material will not exhibit a yield point. In other words, the yield point and failure point coincide. In such cases, the yield strain and failure strain (also known as ultimate strain or elongation) are the same value. On the other hand, ductile materials have a failure strain that is significantly greater than the elastic strain, as shown in the figure below.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"-1\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(from quora.com)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to determine the qualitative brittleness of the material by calculating the ratio of elastic strain to failure strain. A ratio of one indicates complete brittleness, whereas a ratio close to zero indicates essentially no brittleness.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 2 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/8049-stress-strain-properties-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eresilience\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 4 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estrength-to-weight ratio\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"contentType\":\"image/net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"content\":\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":43014,"title":"Beat the test suite if you can :)","description":"Solve this problem based on clues in the test suite.","description_html":"\u003cp\u003eSolve this problem based on clues in the test suite.\u003c/p\u003e","function_template":"function y = beatMe(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [1 2 4 6 4];\r\ny_correct = true;\r\nassert(isequal(beatMe(x),y_correct))\r\n\r\n%%\r\nx = [1 8 3 2 4];\r\ny_correct = true;\r\nassert(isequal(beatMe(x),y_correct))\r\n\r\n%%\r\nx = [7 100003 4000002 6.020 4.1];\r\ny_correct = false;\r\nassert(isequal(beatMe(x),y_correct))\r\n\r\n%%\r\nx = [1 21 45 16 4];\r\ny_correct = false;\r\nassert(isequal(beatMe(x),y_correct))\r\n\r\n%%\r\nx = [1 3 3 2];\r\ny_correct = false;\r\nassert(isequal(beatMe(x),y_correct))","published":true,"deleted":false,"likes_count":10,"comments_count":1,"created_by":13865,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":87,"test_suite_updated_at":"2016-10-29T17:15:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-04T10:27:25.000Z","updated_at":"2026-03-16T10:58:34.000Z","published_at":"2016-10-04T10:28:42.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolve this problem based on clues in the test suite.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":43977,"title":"Converting binary to decimals","description":"Convert binary to decimals.\r\n\r\nExample:\r\n\r\n010111 = 23. \r\n\r\n110000 = 48.","description_html":"\u003cp\u003eConvert binary to decimals.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003e010111 = 23.\u003c/p\u003e\u003cp\u003e110000 = 48.\u003c/p\u003e","function_template":"function y = bin_to_dec(d)\r\n  y = d;\r\nend","test_suite":"%%\r\nd = ('010111');\r\ny_correct = 23;\r\nassert(isequal(bin_to_dec(d),y_correct))\r\n\r\n%%\r\nd = ('110000');\r\ny_correct = 48;\r\nassert(isequal(bin_to_dec(d),y_correct))\r\n\r\n%%\r\nd = ('1000110');\r\ny_correct = 70;\r\nassert(isequal(bin_to_dec(d),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":1,"created_by":108624,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1701,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-12-29T13:49:15.000Z","updated_at":"2026-04-01T08:57:55.000Z","published_at":"2016-12-29T13:51:20.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eConvert binary to decimals.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e010111 = 23.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e110000 = 48.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8055,"title":"Stress-Strain Properties - 8","description":"Up to this point, you've calculated some material properties based on tensile stress-strain data. For this problem, you are tasked with writing a function to calculate all of these properties and gather them, along with supplied properties, such as strain values, into an array. You'll be provided a cell array of strings in the function template; you must return an accompanying numerical array that contains all the specified properties. Below is the list of properties for a material, both supplied and calculated, that make up the array (with variable names that have been used):\r\n\r\n* Yield Strength (S_y)\r\n* Yield Strain (e_y)\r\n* Ultimate Strength (S_u)\r\n* Failure Strain (e_u)\r\n* Poisson's Ratio (nu)\r\n* Shear Modulus (G)\r\n* Elastic Modulus (E)\r\n* Density\r\n* Strain-hardening Exponent (sh_exp)\r\n* Strain-hardening Coefficient (sh_coeff)\r\n* Resilience (R)\r\n* Strength-to-weight Ratio (StWR)\r\n* Stiffness-to-weight Ratio (EtWR)\r\n* Absorbed Strain Energy (ASE)\r\n* Toughness (T)\r\n\r\nPrevious problem: 7 - \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8054-stress-strain-properties-7 toughness\u003e.","description_html":"\u003cp\u003eUp to this point, you've calculated some material properties based on tensile stress-strain data. For this problem, you are tasked with writing a function to calculate all of these properties and gather them, along with supplied properties, such as strain values, into an array. You'll be provided a cell array of strings in the function template; you must return an accompanying numerical array that contains all the specified properties. Below is the list of properties for a material, both supplied and calculated, that make up the array (with variable names that have been used):\u003c/p\u003e\u003cul\u003e\u003cli\u003eYield Strength (S_y)\u003c/li\u003e\u003cli\u003eYield Strain (e_y)\u003c/li\u003e\u003cli\u003eUltimate Strength (S_u)\u003c/li\u003e\u003cli\u003eFailure Strain (e_u)\u003c/li\u003e\u003cli\u003ePoisson's Ratio (nu)\u003c/li\u003e\u003cli\u003eShear Modulus (G)\u003c/li\u003e\u003cli\u003eElastic Modulus (E)\u003c/li\u003e\u003cli\u003eDensity\u003c/li\u003e\u003cli\u003eStrain-hardening Exponent (sh_exp)\u003c/li\u003e\u003cli\u003eStrain-hardening Coefficient (sh_coeff)\u003c/li\u003e\u003cli\u003eResilience (R)\u003c/li\u003e\u003cli\u003eStrength-to-weight Ratio (StWR)\u003c/li\u003e\u003cli\u003eStiffness-to-weight Ratio (EtWR)\u003c/li\u003e\u003cli\u003eAbsorbed Strain Energy (ASE)\u003c/li\u003e\u003cli\u003eToughness (T)\u003c/li\u003e\u003c/ul\u003e\u003cp\u003ePrevious problem: 7 - \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8054-stress-strain-properties-7\"\u003etoughness\u003c/a\u003e.\u003c/p\u003e","function_template":"function [arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff)\r\n\r\narr_descr = {\r\n\t'Yield Strength','Yield Strain','Ultimate Strength','Failure Strain',...\r\n\t'Poisson''s Ratio','Shear Modulus','Elastic Modulus','Density',...\r\n\t'Strain-hardening Exponent','Strain-hardening Coefficient',...\r\n\t'Resilience','Strength-to-weight Ratio','Stiffness-to-weight Ratio',...\r\n\t'Absorbed Strain Energy','Toughness';\r\n};\r\n\r\narr_vals = [\r\n\t1;\r\n];\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26; %Poisson's ratio\r\nG = 79.3e9; %Pa (shear modulus)\r\nE = 200e9; %Pa  (elastic modulus)\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 463e6; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t1.5625e5, 5.096e7, 2.548e10, 12.28e7, 12.26e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 974e6; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t3.0212e6, 19.96e7, 2.528e10, 12.12e7, 11.82e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1845e6; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t3.29918e6, 17.18e7, 2.540e10, 3.535e7, 3.205e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 325e6; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t4.2175e5, 11.11e7, 2.552e10, 4.321e7, 4.279e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 304e6; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t1.89e4, 2.466e7, 1.457e10, 7.342e7, 7.340e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1870e6; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t1.085725e5, 5.376e7, 2.203e10, 20.06e7, 20.05e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e9; %Pa\r\ndensity = 1.14; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t1.0865e6, 7.193e7, 0.272e10, 3.581e7, 3.473e7];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\ndiffs(isnan(diffs)) = 0;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t1.84e6, 15.23e7, 0.960e10, 0.184e7, 0];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\ndiffs(isnan(diffs)) = 0;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\n[arr_vals] = stress_strain8(S_y,S_u,e_y,e_u,nu,G,E,density,sh_exp,sh_coeff);\r\narr_vals_corr = [S_y, e_y, S_u, e_u, nu, G, E, density, sh_exp, sh_coeff,...\r\n\t6e5, 34.19e7, 34.19e10, 0.06e7, 0];\r\ndiffs = abs(arr_vals-arr_vals_corr)./arr_vals_corr;\r\ndiffs(isnan(diffs)) = 0;\r\nfor i = 1:numel(diffs)\r\n\tassert(diffs(i)\u003c1e-2)\r\nend\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":48,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-31T02:36:58.000Z","updated_at":"2026-02-19T09:49:12.000Z","published_at":"2015-03-31T02:36:58.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eUp to this point, you've calculated some material properties based on tensile stress-strain data. For this problem, you are tasked with writing a function to calculate all of these properties and gather them, along with supplied properties, such as strain values, into an array. You'll be provided a cell array of strings in the function template; you must return an accompanying numerical array that contains all the specified properties. Below is the list of properties for a material, both supplied and calculated, that make up the array (with variable names that have been used):\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYield Strength (S_y)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYield Strain (e_y)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eUltimate Strength (S_u)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFailure Strain (e_u)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePoisson's Ratio (nu)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eShear Modulus (G)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eElastic Modulus (E)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDensity\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eStrain-hardening Exponent (sh_exp)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eStrain-hardening Coefficient (sh_coeff)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eResilience (R)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eStrength-to-weight Ratio (StWR)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eStiffness-to-weight Ratio (EtWR)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAbsorbed Strain Energy (ASE)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eToughness (T)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 7 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8054-stress-strain-properties-7\\\"\u003e\u003cw:r\u003e\u003cw:t\u003etoughness\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":8054,"title":"Stress-Strain Properties - 7","description":"The toughness of a material is technically defined as the plastic strain energy absorbed by the material (the plastic region in the figure below). Practically speaking, it's a measure of how much deformation a material can undergo (or energy it can absorb) before failure.\r\n\r\nWrite a function to calculate the toughness of a material—the absorbed strain energy minus the resilience. This can be accomplished by combining the code written in problem 2 (resilience) and problem 6 (absorbed strain energy). Also, return the fraction of absorbed strain energy that the toughness represents.\r\nPrevious problem: 6 - absorbed strain energy. Next problem: 8 - material properties list.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440001px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 499px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 249.5px; transform-origin: 332px 249.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 31.5px; text-align: left; transform-origin: 309px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe toughness of a material is technically defined as the plastic strain energy absorbed by the material (the plastic region in the figure below). Practically speaking, it's a measure of how much deformation a material can undergo (or energy it can absorb) before failure.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 304px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 152px; text-align: center; transform-origin: 309px 152px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline\" src=\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 42px; text-align: left; transform-origin: 309px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWrite a function to calculate the toughness of a material—the absorbed strain energy minus the resilience. This can be accomplished by combining the code written in\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/8049-stress-strain-properties-2\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eproblem 2\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e (resilience) and\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eproblem 6\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e (absorbed strain energy). Also, return the fraction of absorbed strain energy that the toughness represents.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: left; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ePrevious problem: 6 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eabsorbed strain energy\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. Next problem: 8 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ematerial properties list\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff)\r\n\r\nT = 1;\r\n\r\nfrac = 0.5;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals, are generally\r\n% isotropic, whereas others, like composites, are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 463e6; %strain-hardening coefficient\r\nT_corr = 12.26e7;\r\nfrac_corr = 0.9987;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 974e6; %strain-hardening coefficient\r\nT_corr = 11.82e7;\r\nfrac_corr = 0.9751;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1845e6; %strain-hardening coefficient\r\nT_corr = 3.205e7;\r\nfrac_corr = 0.9067;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 325e6; %strain-hardening coefficient\r\nT_corr = 4.279e7;\r\nfrac_corr = 0.9902;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 304e6; %strain-hardening coefficient\r\nT_corr = 7.340e7;\r\nfrac_corr = 0.9997;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1870e6; %strain-hardening coefficient\r\nT_corr = 20.05e7;\r\nfrac_corr = 0.9995;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e9; %Pa\r\ndensity = 1.14; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\nT_corr = 3.473e7;\r\nfrac_corr = 0.9697;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\nassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\nT_corr = 0;\r\nfrac_corr = 0;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(isequal(T,T_corr))\r\nassert(isequal(frac,frac_corr))\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\nT_corr = 0;\r\nfrac_corr = 0;\r\n[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\nassert(isequal(T,T_corr))\r\nassert(isequal(frac,frac_corr))\r\n\r\n%%\r\nfor i = 1:30\r\nind = randi(8);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 250e6; %Pa\r\n\t\te_y = 0.00125;\r\n\t\te_u = 0.35;\r\n\t\tsh_exp = 0.14; %strain-hardening exponent\r\n\t\tsh_coeff = 463e6; %strain-hardening coefficient\r\n\t\tT_corr = 12.26e7;\r\n\t\tfrac_corr = 0.9987;\r\n\t\t[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\n\t\tassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\n\t\tassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\tcase 2\r\n\t\tS_y = 830e6; %Pa\r\n\t\te_y = 0.00728;\r\n\t\te_u = 0.14;\r\n\t\tsh_exp = 0.04; %strain-hardening exponent\r\n\t\tsh_coeff = 974e6; %strain-hardening coefficient\r\n\t\tT_corr = 11.82e7;\r\n\t\tfrac_corr = 0.9751;\r\n\t\t[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\n\t\tassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\n\t\tassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\tcase 3\r\n\t\tS_y = 230e6; %Pa\r\n\t\te_y = 0.016;\r\n\t\te_u = 0.016;\r\n\t\tsh_exp = 0; %strain-hardening exponent\r\n\t\tsh_coeff = 0; %strain-hardening coefficient\r\n\t\tT_corr = 0;\r\n\t\tfrac_corr = 0;\r\n\t\t[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\n\t\tassert(isequal(T,T_corr))\r\n\t\tassert(isequal(frac,frac_corr))\r\n\tcase 4\r\n\t\tS_y = 317e6; %Pa\r\n\t\te_y = 0.000685;\r\n\t\te_u = 0.24;\r\n\t\tsh_exp = 0.353; %strain-hardening exponent\r\n\t\tsh_coeff = 1870e6; %strain-hardening coefficient\r\n\t\tT_corr = 20.05e7;\r\n\t\tfrac_corr = 0.9995;\r\n\t\t[T,frac] = stress_strain7(e_y,e_u,S_y,sh_exp,sh_coeff);\r\n\t\tassert(abs(T-T_corr)/T_corr\u003c1e-2)\r\n\t\tassert(abs(frac-frac_corr)/frac_corr\u003c1e-2)\r\n\tcase 5\r\n\t\tS_y = 70e6; %Pa\r\n\t\te_y = 0.00054;\r\n\t\te_u = 0.48;\r\n\t\tsh_exp = 0.44; %strain-hardening exponent\r\n\t\tsh_coeff = 304e6; %strain-hardening coefficient\r\n\t\tT_corr = 7.340e7;\r\n\t\tfrac_corr = 0.9997;\r\n\tcase 6\r\n\t\tS_y = 1172e6; %Pa\r\n\t\te_y = 0.00563;\r\n\t\te_u = 0.027;\r\n\t\tsh_exp = 0.075; %strain-hardening exponent\r\n\t\tsh_coeff = 1845e6; %strain-hardening coefficient\r\n\t\tT_corr = 3.205e7;\r\n\t\tfrac_corr = 0.9067;\r\n\tcase 7\r\n\t\tS_y = 82e6; %Pa\r\n\t\te_y = 0.0265;\r\n\t\te_u = 0.45;\r\n\t\tsh_exp = 0; %strain-hardening exponent\r\n\t\tsh_coeff = 0; %strain-hardening coefficient\r\n\t\tT_corr = 3.473e7;\r\n\t\tfrac_corr = 0.9697;\r\n\tcase 8\r\n\t\tS_y = 241e6; %Pa\r\n\t\te_y = 0.0035;\r\n\t\te_u = 0.15;\r\n\t\tsh_exp = 0.042; %strain-hardening exponent\r\n\t\tsh_coeff = 325e6; %strain-hardening coefficient\r\n\t\tT_corr = 4.279e7;\r\n\t\tfrac_corr = 0.9902;\r\nend\r\nend % for i = 1:30\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":26769,"edited_by":26769,"edited_at":"2024-03-27T17:44:32.000Z","deleted_by":null,"deleted_at":null,"solvers_count":88,"test_suite_updated_at":"2021-08-03T17:04:10.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T22:03:11.000Z","updated_at":"2026-02-19T09:46:19.000Z","published_at":"2015-03-30T22:03:11.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe toughness of a material is technically defined as the plastic strain energy absorbed by the material (the plastic region in the figure below). Practically speaking, it's a measure of how much deformation a material can undergo (or energy it can absorb) before failure.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"298\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"420\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to calculate the toughness of a material—the absorbed strain energy minus the resilience. This can be accomplished by combining the code written in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/8049-stress-strain-properties-2\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eproblem 2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (resilience) and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eproblem 6\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (absorbed strain energy). Also, return the fraction of absorbed strain energy that the toughness represents.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 6 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eabsorbed strain energy\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 8 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ematerial properties list\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"contentType\":\"image/net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"content\":\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":8053,"title":"Stress-Strain Properties - 6","description":"The total energy absorbed by a material up to failure in a tensile test is termed the absorbed strain energy. With respect to the figure below, it is the total area of the elastic and plastic regions and can be calculated by integrating the stress-strain curve. As a first approximation, many stress-strain responses can be approximated by:\r\n\r\nwhere K is a strength coefficient, eps_p is the plastic strain, and n is the hardening exponent. Stress as a function of strain can be calculated by creating a strain vector from zero to the ultimate strain and integrating the stress values in that vector.\r\n\r\n(from quora.com)\r\nWrite a function to return the absorbed strain energy for a material provided K and n. If the material does not strain harden, then K and n will be set equal to zero. In these cases, the absorbed strain energy is equal to the resilience (triangular area up to yield point) and any absorbed plastic energy, if applicable, which can be approximated by a rectangle from the yield point to the failure point with those stresses being equal. If the ultimate strain equals the yield strain, that rectangular area is zero.\r\nPrevious problem: 5 - stiffness-to-weight ratio. Next problem: 7 - toughness.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440001px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 702px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 351px; transform-origin: 332px 351px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 42px; text-align: left; transform-origin: 309px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe total energy absorbed by a material up to failure in a tensile test is termed the absorbed strain energy. With respect to the figure below, it is the total area of the elastic and plastic regions and can be calculated by integrating the stress-strain curve. As a first approximation, many stress-strain responses can be approximated by:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 29px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 14.5px; text-align: center; transform-origin: 309px 14.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" width=\"73\" height=\"23\" style=\"vertical-align: baseline;width: 73px;height: 23px\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAXBAMAAAC12X9oAAAAMFBMVEX///8WFhZQUFBAQEAwMDBiYmLm5uZ0dHTMzMyKiooMDAyenp4EBAQiIiK2trYAAAARmbiRAAAAAXRSTlMAQObYZgAAAU9JREFUeNpjZiAAUsUCn31gwipV+8ebgfv/PRBTO7b7AgN2VRP/bmX4fVMJxCzz5tuAQ9X3vwwM9zXATOYHXxpwqOJYxcB5GsL81fD/KA4n8xswRECZLA1M0QzMDHw3JjQ4LkBV9YJR9d8FEGPrnccH/l8G2rhmZ8NzB6CAoSAIgOUYCu49CgDRDw+egmhj+8fAG4Buo9dsfpBGtpNQPtM/IwaGC+iqGp5+2Qak/l2HqeLewPC3AN2Lug2sf4A0d7FxA0SkH4gSGFDdxf6DgUEG5NUJMI8C8eJzINZ5MN8ARPw9wcDQ/LGA4S/cdMYGTgxn8QCdzi8ANNMAKsDM9sU8F00Rs8SU/9dczyVN+BtrW8q7nH35BEZCKWeCZCoTjpSDBArE/05gIKiKW+D7BAaCNjLJeX1bQEgRA6+6BQNhwAM2kJCqq8SoYvu5AUgCAMD/X3IO0icRAAAAAElFTkSuQmCC\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 31.5px; text-align: left; transform-origin: 309px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ewhere K is a strength coefficient, eps_p is the plastic strain, and n is the hardening exponent. Stress as a function of strain can be calculated by creating a strain vector from zero to the ultimate strain and integrating the stress values in that vector.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 304px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 152px; text-align: center; transform-origin: 309px 152px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cimg class=\"imageNode\" style=\"vertical-align: baseline\" src=\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: center; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e(from quora.com)\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 126px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 63px; text-align: left; transform-origin: 309px 63px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eWrite a function to return the absorbed strain energy for a material provided K and n. If the material does not strain harden, then K and n will be set equal to zero. In these cases, the absorbed strain energy is equal to the resilience (triangular area up to yield point) and any absorbed plastic energy, if applicable, which can be approximated by a rectangle from the yield point to the failure point with those stresses being equal. If the ultimate strain equals the yield strain, that rectangular area is zero.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 309px 10.5px; text-align: left; transform-origin: 309px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003ePrevious problem: 5 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003estiffness-to-weight ratio\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e. Next problem: 7 -\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003etoughness\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [ASE] = stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)\r\n\r\nASE = 1;\r\n\r\nend\r\n","test_suite":"%% Note\r\n% The following properties are measured at room temperature and are tensile\r\n% in a single direction. Some materials, such as metals are generally\r\n% isotropic, whereas others, like composite are highly anisotropic\r\n% (different properties in different directions). Also, property values can\r\n% range depending on the material grade. Finally, thermal or environmental\r\n% changes can alter these properties, sometimes drastically.\r\n\r\n%% steel alloy (ASTM A36)\r\nS_y = 250e6; %Pa\r\nS_u = 400e6; %Pa\r\ne_y = 0.00125;\r\ne_u = 0.35;\r\nnu = 0.26;\r\nG = 79.3e9; %Pa\r\nE = 200e9; %Pa\r\ndensity = 7.85; %g/cm^3\r\nsh_exp = 0.14; %strain-hardening exponent\r\nsh_coeff = 463e6; %strain-hardening coefficient\r\nASE_corr = 12.28e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% titanium (Ti-6Al-4V)\r\nS_y = 830e6; %Pa\r\nS_u = 900e6; %Pa\r\ne_y = 0.00728;\r\ne_u = 0.14;\r\nnu = 0.342;\r\nG = 44e9; %Pa\r\nE = 114e9; %Pa\r\ndensity = 4.51; %g/cm^3\r\nsh_exp = 0.04; %strain-hardening exponent\r\nsh_coeff = 974e6; %strain-hardening coefficient\r\nASE_corr = 12.12e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% Inconel 718\r\nS_y = 1172e6; %Pa\r\nS_u = 1407e6; %Pa\r\ne_y = 0.00563;\r\ne_u = 0.027;\r\nnu = 0.29;\r\nG = 11.6e9; %Pa\r\nE = 208e9; %Pa\r\ndensity = 8.19; %g/cm^3\r\nsh_exp = 0.075; %strain-hardening exponent\r\nsh_coeff = 1845e6; %strain-hardening coefficient\r\nASE_corr = 3.535e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% aluminum alloy (6061-T6)%^\u0026\r\nS_y = 241e6; %Pa\r\nS_u = 300e6; %Pa\r\ne_y = 0.0035;\r\ne_u = 0.15;\r\nnu = 0.33;\r\nG = 26e9; %Pa\r\nE = 68.9e9; %Pa\r\ndensity = 2.7; %g/cm^3\r\nsh_exp = 0.042; %strain-hardening exponent\r\nsh_coeff = 325e6; %strain-hardening coefficient\r\nASE_corr = 4.321e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% copper\r\nS_y = 70e6; %Pa\r\nS_u = 220e6; %Pa\r\ne_y = 0.00054;\r\ne_u = 0.48;\r\nnu = 0.34;\r\nG = 48e9; %Pa\r\nE = 130e9; %Pa\r\ndensity = 8.92; %g/cm^3\r\nsh_exp = 0.44; %strain-hardening exponent\r\nsh_coeff = 304e6; %strain-hardening coefficient\r\nASE_corr = 7.342e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% rhenium\r\nS_y = 317e6; %Pa\r\nS_u = 1130e6; %Pa\r\ne_y = 0.000685;\r\ne_u = 0.24;\r\nnu = 0.3;\r\nG = 178e9; %Pa\r\nE = 463e9; %Pa\r\ndensity = 21.02; %g/cm^3\r\nsh_exp = 0.353; %strain-hardening exponent\r\nsh_coeff = 1870e6; %strain-hardening coefficient\r\nASE_corr = 20.06e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6)\r\nS_y = 82e6; %Pa\r\nS_u = 82e6; %Pa\r\ne_y = 0.0265;\r\ne_u = 0.45;\r\nnu = 0.41;\r\nG = 2.8e9; %Pa\r\nE = 3.1e9; %Pa\r\ndensity = 1.14; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\nASE_corr = 3.581e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% polymer (nylon, 6/6) reinforced with 45wt.% glass fiber\r\nS_y = 230e6; %Pa\r\nS_u = 230e6; %Pa\r\ne_y = 0.016;\r\ne_u = 0.016;\r\nnu = 0.35;\r\nG = 13.0e9; %Pa\r\nE = 14.5e9; %Pa\r\ndensity = 1.51; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\nASE_corr = 0.184e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%% diamond\r\nS_y = 1200e6; %Pa\r\nS_u = 1200e6; %Pa\r\ne_y = 0.001;\r\ne_u = 0.001;\r\nnu = 0.20;\r\nG = 478e9; %Pa\r\nE = 1200e9; %Pa\r\ndensity = 3.51; %g/cm^3\r\nsh_exp = 0; %strain-hardening exponent\r\nsh_coeff = 0; %strain-hardening coefficient\r\nASE_corr = 0.06e7;\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 250e6; %Pa\r\n\t\te_y = 0.00125;\r\n\t\te_u = 0.35;\r\n\t\tsh_exp = 0.14; %strain-hardening exponent\r\n\t\tsh_coeff = 463e6; %strain-hardening coefficient\r\n\t\tASE_corr = 12.28e7;\r\n\tcase 2\r\n\t\tS_y = 82e6; %Pa\r\n\t\te_y = 0.0265;\r\n\t\te_u = 0.45;\r\n\t\tsh_exp = 0; %strain-hardening exponent\r\n\t\tsh_coeff = 0; %strain-hardening coefficient\r\n\t\tASE_corr = 3.581e7;\r\n\tcase 3\r\n\t\tS_y = 241e6; %Pa\r\n\t\te_y = 0.0035;\r\n\t\te_u = 0.15;\r\n\t\tsh_exp = 0.042; %strain-hardening exponent\r\n\t\tsh_coeff = 325e6; %strain-hardening coefficient\r\n\t\tASE_corr = 4.321e7;\r\n\tcase 4\r\n\t\tS_y = 317e6; %Pa\r\n\t\te_y = 0.000685;\r\n\t\te_u = 0.24;\r\n\t\tsh_exp = 0.353; %strain-hardening exponent\r\n\t\tsh_coeff = 1870e6; %strain-hardening coefficient\r\n\t\tASE_corr = 20.06e7;\r\nend\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 830e6; %Pa\r\n\t\te_y = 0.00728;\r\n\t\te_u = 0.14;\r\n\t\tsh_exp = 0.04; %strain-hardening exponent\r\n\t\tsh_coeff = 974e6; %strain-hardening coefficient\r\n\t\tASE_corr = 12.12e7;\r\n\tcase 2\r\n\t\tS_y = 241e6; %Pa\r\n\t\te_y = 0.0035;\r\n\t\te_u = 0.15;\r\n\t\tsh_exp = 0.042; %strain-hardening exponent\r\n\t\tsh_coeff = 325e6; %strain-hardening coefficient\r\n\t\tASE_corr = 4.321e7;\r\n\tcase 3\r\n\t\tS_y = 250e6; %Pa\r\n\t\te_y = 0.00125;\r\n\t\te_u = 0.35;\r\n\t\tsh_exp = 0.14; %strain-hardening exponent\r\n\t\tsh_coeff = 463e6; %strain-hardening coefficient\r\n\t\tASE_corr = 12.28e7;\r\n\tcase 4\r\n\t\tS_y = 70e6; %Pa\r\n\t\te_y = 0.00054;\r\n\t\te_u = 0.48;\r\n\t\tsh_exp = 0.44; %strain-hardening exponent\r\n\t\tsh_coeff = 304e6; %strain-hardening coefficient\r\n\t\tASE_corr = 7.342e7;\r\nend\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tS_y = 1200e6; %Pa\r\n\t\te_y = 0.001;\r\n\t\te_u = 0.001;\r\n\t\tsh_exp = 0; %strain-hardening exponent\r\n\t\tsh_coeff = 0; %strain-hardening coefficient\r\n\t\tASE_corr = 0.06e7;\r\n\tcase 2\r\n\t\tS_y = 250e6; %Pa\r\n\t\te_y = 0.00125;\r\n\t\te_u = 0.35;\r\n\t\tsh_exp = 0.14; %strain-hardening exponent\r\n\t\tsh_coeff = 463e6; %strain-hardening coefficient\r\n\t\tASE_corr = 12.28e7;\r\n\tcase 3\r\n\t\tS_y = 230e6; %Pa\r\n\t\te_y = 0.016;\r\n\t\te_u = 0.016;\r\n\t\tsh_exp = 0; %strain-hardening exponent\r\n\t\tsh_coeff = 0; %strain-hardening coefficient\r\n\t\tASE_corr = 0.184e7;\r\n\tcase 4\r\n\t\tS_y = 1172e6; %Pa\r\n\t\te_y = 0.00563;\r\n\t\te_u = 0.027;\r\n\t\tsh_exp = 0.075; %strain-hardening exponent\r\n\t\tsh_coeff = 1845e6; %strain-hardening coefficient\r\n\t\tASE_corr = 3.535e7;\r\nend\r\nassert(abs(stress_strain6(e_u,sh_exp,sh_coeff,S_y,e_y)-ASE_corr)/ASE_corr\u003c1e-2)\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":7,"created_by":26769,"edited_by":26769,"edited_at":"2024-03-27T17:39:31.000Z","deleted_by":null,"deleted_at":null,"solvers_count":92,"test_suite_updated_at":"2015-03-30T21:25:46.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-03-30T20:58:35.000Z","updated_at":"2026-02-19T09:44:40.000Z","published_at":"2015-03-30T21:25:46.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe total energy absorbed by a material up to failure in a tensile test is termed the absorbed strain energy. With respect to the figure below, it is the total area of the elastic and plastic regions and can be calculated by integrating the stress-strain curve. As a first approximation, many stress-strain responses can be approximated by:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"23\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"73\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId1\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ewhere K is a strength coefficient, eps_p is the plastic strain, and n is the hardening exponent. Stress as a function of strain can be calculated by creating a strain vector from zero to the ultimate strain and integrating the stress values in that vector.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"298\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"420\\\"/\u003e\u003cw:attr w:name=\\\"verticalAlign\\\" w:val=\\\"baseline\\\"/\u003e\u003cw:attr w:name=\\\"altText\\\" w:val=\\\"\\\"/\u003e\u003cw:attr w:name=\\\"relationshipId\\\" w:val=\\\"rId2\\\"/\u003e\u003c/w:customXmlPr\u003e\u003c/w:customXml\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"center\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e(from quora.com)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to return the absorbed strain energy for a material provided K and n. If the material does not strain harden, then K and n will be set equal to zero. In these cases, the absorbed strain energy is equal to the resilience (triangular area up to yield point) and any absorbed plastic energy, if applicable, which can be approximated by a rectangle from the yield point to the failure point with those stresses being equal. If the ultimate strain equals the yield strain, that rectangular area is zero.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePrevious problem: 5 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003estiffness-to-weight ratio\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Next problem: 7 -\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003etoughness\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.png\",\"relationshipId\":\"rId1\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"target\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationshipId\":\"rId2\"}]},{\"partUri\":\"/media/image1.png\",\"contentType\":\"image/png\",\"content\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAXBAMAAAC12X9oAAAAMFBMVEX///8WFhZQUFBAQEAwMDBiYmLm5uZ0dHTMzMyKiooMDAyenp4EBAQiIiK2trYAAAARmbiRAAAAAXRSTlMAQObYZgAAAU9JREFUeNpjZiAAUsUCn31gwipV+8ebgfv/PRBTO7b7AgN2VRP/bmX4fVMJxCzz5tuAQ9X3vwwM9zXATOYHXxpwqOJYxcB5GsL81fD/KA4n8xswRECZLA1M0QzMDHw3JjQ4LkBV9YJR9d8FEGPrnccH/l8G2rhmZ8NzB6CAoSAIgOUYCu49CgDRDw+egmhj+8fAG4Buo9dsfpBGtpNQPtM/IwaGC+iqGp5+2Qak/l2HqeLewPC3AN2Lug2sf4A0d7FxA0SkH4gSGFDdxf6DgUEG5NUJMI8C8eJzINZ5MN8ARPw9wcDQ/LGA4S/cdMYGTgxn8QCdzi8ANNMAKsDM9sU8F00Rs8SU/9dczyVN+BtrW8q7nH35BEZCKWeCZCoTjpSDBArE/05gIKiKW+D7BAaCNjLJeX1bQEgRA6+6BQNhwAM2kJCqq8SoYvu5AUgCAMD/X3IO0icRAAAAAElFTkSuQmCC\",\"relationship\":null},{\"partUri\":\"/media/image1.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"contentType\":\"image/net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"content\":\"https://qph.cf2.quoracdn.net/main-qimg-b2693f4b9ea8430af25df920757e0b29-lq\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"term":"tag:\"test\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"test\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"test\"","","\"","test","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f534935e398\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f534935e2f8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f534935da38\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f534935e618\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f534935e578\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f534935e4d8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f534935e438\u003e":"tag:\"test\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f534935e438\u003e":"tag:\"test\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"test\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"test\"","","\"","test","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f534935e398\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f534935e2f8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f534935da38\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f534935e618\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f534935e578\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f534935e4d8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f534935e438\u003e":"tag:\"test\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f534935e438\u003e":"tag:\"test\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":47128,"difficulty_rating":"easy"},{"id":43691,"difficulty_rating":"easy"},{"id":2115,"difficulty_rating":"easy"},{"id":43689,"difficulty_rating":"easy"},{"id":58269,"difficulty_rating":"easy"},{"id":2118,"difficulty_rating":"easy"},{"id":46711,"difficulty_rating":"easy"},{"id":43694,"difficulty_rating":"easy"},{"id":1375,"difficulty_rating":"easy"},{"id":8048,"difficulty_rating":"easy"},{"id":2,"difficulty_rating":"easy"},{"id":8051,"difficulty_rating":"easy"},{"id":8052,"difficulty_rating":"easy"},{"id":8049,"difficulty_rating":"easy"},{"id":45206,"difficulty_rating":"easy"},{"id":8050,"difficulty_rating":"easy"},{"id":43014,"difficulty_rating":"easy"},{"id":43977,"difficulty_rating":"easy-medium"},{"id":8055,"difficulty_rating":"easy-medium"},{"id":8054,"difficulty_rating":"medium"},{"id":8053,"difficulty_rating":"medium"}]}}