{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.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":"2026-04-06T00: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":57978,"title":"Calculate BMI","description":"Given weight in kgs and height in metres, calculate body mass index","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 10.5px; transform-origin: 407.5px 10.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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 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 weight in kgs and height in metres, calculate body mass index\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = bmi(a,b)\r\n  y = [a,b];\r\nend","test_suite":"%%\r\na = 100;\r\nb=1.82\r\ny_correct = 30.18;\r\nassert(isequal(bmi(a,b),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":3,"created_by":2457335,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":34,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-04-13T23:51:12.000Z","updated_at":"2026-04-02T13:53:43.000Z","published_at":"2023-04-13T23:51:12.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\u003eGiven weight in kgs and height in metres, calculate body mass index\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":43010,"title":"kmph to mph converter","description":"Convert the speed in miles/hour to km/hour.","description_html":"\u003cp\u003eConvert the speed in miles/hour to km/hour.\u003c/p\u003e","function_template":"function y = mph2kmph(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 1.60934;\r\nassert(isequal(mph2kmph(x),y_correct))\r\n\r\n%%\r\nx = 10;\r\ny_correct = 16.0934;\r\nassert(isequal(mph2kmph(x),y_correct))\r\n\r\n%%\r\nx = 5;\r\ny_correct = 8.0467;\r\nassert(isequal(mph2kmph(x),y_correct))\r\n\r\n%%\r\nx = 50;\r\ny_correct = 80.467;\r\nassert(isequal(mph2kmph(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":0,"created_by":91311,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":194,"test_suite_updated_at":"2016-10-04T04:45:23.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-04T04:43:44.000Z","updated_at":"2026-03-29T19:27:46.000Z","published_at":"2016-10-04T04:43:44.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 the speed in miles/hour to km/hour.\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":42655,"title":"Convert yards to feet","description":"The goal of this script is to convert a value given in yards to feet.","description_html":"\u003cp\u003eThe goal of this script is to convert a value given in yards to feet.\u003c/p\u003e","function_template":"function y = yards_to_feet(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 9;\r\ny_correct = 27;\r\nassert(isequal(yards_to_feet(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":49473,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":562,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-10-07T19:17:28.000Z","updated_at":"2026-02-06T15:54:52.000Z","published_at":"2015-10-07T19:20:09.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\u003eThe goal of this script is to convert a value given in yards to feet.\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":43802,"title":"Energy-Mass Equivalence","description":"Given input enegy of the object, E, and constant c = 300,000,000, find the mass of the object.","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: 51px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 25.5px; transform-origin: 407px 25.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=\"\"\u003eIn a system's rest frame, given the enegy of an object, E (in Joules), find the rest mass of the object (in kilograms).\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=\"\"\u003eTake speed of light, c = 300,000,000 m/s.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function m = EnergyMass(E)\r\n  m;\r\nend","test_suite":"%%\r\nE = 5.490e+18;\r\ny_correct = 61;\r\nassert(isequal(EnergyMass(E),y_correct))\r\n\r\n%%\r\nE = 1.350e+19;\r\ny_correct = 25*6;\r\nassert(isequal(EnergyMass(E),y_correct))\r\n\r\n%%\r\nE = 9e16;\r\ny_correct = 1;\r\nassert(isequal(EnergyMass(E),y_correct))\r\n\r\n%%\r\nE = 1.17e18;\r\ny_correct = sqrt(169);\r\nassert(isequal(EnergyMass(E),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":100606,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":88,"test_suite_updated_at":"2021-02-21T11:53:56.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-12-13T23:20:40.000Z","updated_at":"2026-02-11T11:50:47.000Z","published_at":"2016-12-13T23:20:44.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 system's rest frame, given the enegy of an object, E (in Joules), find the rest mass of the object (in kilograms).\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\u003eTake speed of light, c = 300,000,000 m/s.\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":43214,"title":"Convert degrees to radians","description":"Given input in degrees, output to radians","description_html":"\u003cp\u003eGiven input in degrees, output to radians\u003c/p\u003e","function_template":"function y = DEG2RAD(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 180;\r\ny_correct = pi;\r\nassert(abs(DEG2RAD(x)-y_correct)\u003c0.01)\r\n%%\r\nx = -180;\r\ny_correct = -pi;\r\nassert(abs(DEG2RAD(x)-y_correct)\u003c0.01)\r\n%%\r\nx = 90;\r\ny_correct = pi/2;\r\nassert(abs(DEG2RAD(x)-y_correct)\u003c0.01)\r\n%%\r\nx = 45;\r\ny_correct = pi/4;\r\nassert(abs(DEG2RAD(x)-y_correct)\u003c0.01)\r\n","published":true,"deleted":false,"likes_count":11,"comments_count":0,"created_by":13865,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":313,"test_suite_updated_at":"2016-10-29T16:54:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-08T10:07:06.000Z","updated_at":"2026-03-03T22:24:46.000Z","published_at":"2016-10-08T10:07:06.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\u003eGiven input in degrees, output to radians\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":45281,"title":"A \"Complex\" Converter: Rectangular Form \u003c-\u003e Polar Form","description":"*BACKGROUND / MOTIVATION:*\r\n\r\nComplex numbers can be an important tool in an electrical engineer's toolbox because they can help us describe / work with sinusoidal signals.\r\n\r\nSinusoidal signals can be found all over the place in day-to-day life (in music, light, communication systems, power systems, etc.):\r\n\r\n* \"Why Study Sinusoids?\": \u003chttps://www.youtube.com/watch?v=yXjXJ5OlNyQ\u003e\r\n* \"Euler's formula\": \u003chttps://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-eulers-formula\u003e\r\n\r\nWhen working with complex numbers, sometimes it's easier to work with the \"rectangular/Cartesian form\" (z = x + j*y) and sometimes it's easier to work with the \"polar form\" (r ∠ θ).\r\n\r\n_An analogy:_\r\n\r\n* Using the rectangular form is sometimes like using decimals: it can make the numbers easier to add / subtract\r\n* Using the polar form is sometimes like using fractions: it can the numbers easier to multiply / divide\r\n* In the end, the two forms are equivalent, but sometimes they're easier to work with in one form instead of another.\r\n\r\n*PROBLEM DESCRIPTION*\r\n\r\nWrite a function which converts between the rectangular form and the polar form.\r\n\r\nYou can view a comparison of the two forms here:\r\n\u003chttps://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-complex-numbers\u003e\r\n\r\nThe variable \"form\" will be used to determine whether the function converts from rectangular to polar or from polar to rectangular.\r\n\r\nThe function takes the following inputs:\r\n\r\n* \"input1\" - a variable which is either \"x\" (the real component in rectangular form) or \"r\" (the radius in polar form)\r\n* \"input2\" - a variable which is either \"y\" (the complex component in rectangular form) or \"theta\" (the angle, in degrees, in polar form)\r\n* \"form\" - a variable which is set to either \"r2p\" (to convert from rectangular to polar) or \"p2r\" (to convert from polar to rectangular)\r\n\r\nThe function will output the variable \"output\" in the form of a column vector [output1;output2] where:\r\n\r\n* \"output1\" - a component of the output which is either \"x\" (the real component in rectangular form) or \"r\" (the radius in polar form)\r\n* \"output2\" - a component of the output which is either \"y\" (the complex component in rectangular form) or \"theta\" (the positive angle, in degrees, in polar form)\r\n\r\nThe test suite will round the components of your output vector to 4 decimal places.\r\n\r\n*FEEDBACK*\r\n\r\nPlease feel free to leave feedback on this problem in the comments!  :)","description_html":"\u003cp\u003e\u003cb\u003eBACKGROUND / MOTIVATION:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eComplex numbers can be an important tool in an electrical engineer's toolbox because they can help us describe / work with sinusoidal signals.\u003c/p\u003e\u003cp\u003eSinusoidal signals can be found all over the place in day-to-day life (in music, light, communication systems, power systems, etc.):\u003c/p\u003e\u003cul\u003e\u003cli\u003e\"Why Study Sinusoids?\": \u003ca href = \"https://www.youtube.com/watch?v=yXjXJ5OlNyQ\"\u003ehttps://www.youtube.com/watch?v=yXjXJ5OlNyQ\u003c/a\u003e\u003c/li\u003e\u003cli\u003e\"Euler's formula\": \u003ca href = \"https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-eulers-formula\"\u003ehttps://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-eulers-formula\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eWhen working with complex numbers, sometimes it's easier to work with the \"rectangular/Cartesian form\" (z = x + j*y) and sometimes it's easier to work with the \"polar form\" (r ∠ θ).\u003c/p\u003e\u003cp\u003e\u003ci\u003eAn analogy:\u003c/i\u003e\u003c/p\u003e\u003cul\u003e\u003cli\u003eUsing the rectangular form is sometimes like using decimals: it can make the numbers easier to add / subtract\u003c/li\u003e\u003cli\u003eUsing the polar form is sometimes like using fractions: it can the numbers easier to multiply / divide\u003c/li\u003e\u003cli\u003eIn the end, the two forms are equivalent, but sometimes they're easier to work with in one form instead of another.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cb\u003ePROBLEM DESCRIPTION\u003c/b\u003e\u003c/p\u003e\u003cp\u003eWrite a function which converts between the rectangular form and the polar form.\u003c/p\u003e\u003cp\u003eYou can view a comparison of the two forms here: \u003ca href = \"https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-complex-numbers\"\u003ehttps://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-complex-numbers\u003c/a\u003e\u003c/p\u003e\u003cp\u003eThe variable \"form\" will be used to determine whether the function converts from rectangular to polar or from polar to rectangular.\u003c/p\u003e\u003cp\u003eThe function takes the following inputs:\u003c/p\u003e\u003cul\u003e\u003cli\u003e\"input1\" - a variable which is either \"x\" (the real component in rectangular form) or \"r\" (the radius in polar form)\u003c/li\u003e\u003cli\u003e\"input2\" - a variable which is either \"y\" (the complex component in rectangular form) or \"theta\" (the angle, in degrees, in polar form)\u003c/li\u003e\u003cli\u003e\"form\" - a variable which is set to either \"r2p\" (to convert from rectangular to polar) or \"p2r\" (to convert from polar to rectangular)\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThe function will output the variable \"output\" in the form of a column vector [output1;output2] where:\u003c/p\u003e\u003cul\u003e\u003cli\u003e\"output1\" - a component of the output which is either \"x\" (the real component in rectangular form) or \"r\" (the radius in polar form)\u003c/li\u003e\u003cli\u003e\"output2\" - a component of the output which is either \"y\" (the complex component in rectangular form) or \"theta\" (the positive angle, in degrees, in polar form)\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThe test suite will round the components of your output vector to 4 decimal places.\u003c/p\u003e\u003cp\u003e\u003cb\u003eFEEDBACK\u003c/b\u003e\u003c/p\u003e\u003cp\u003ePlease feel free to leave feedback on this problem in the comments!  :)\u003c/p\u003e","function_template":"function [output] = complexConverter(input1, input2, form)\r\n  % write a function which converts from rectangular to polar and polar to rectangular\r\nend","test_suite":"%%Test1\r\ninput1 = 2; %x\r\ninput2 = 2; %y\r\nform = 'r2p';\r\noutput1 = 2.8284;\r\noutput2 = 45;\r\noutput = [output1;output2];\r\nassert(isequal(round(complexConverter(input1, input2, form),4),output))\r\n%%Test2\r\ninput1 = 3; %radius\r\ninput2 = 60; %degrees\r\nform = 'p2r';\r\noutput1 = 1.5000;\r\noutput2 = 2.5981;\r\noutput = [output1;output2];\r\nassert(isequal(round(complexConverter(input1, input2, form),4),output))\r\n%%Test3\r\ninput1 = 3; %x\r\ninput2 = -4; %y\r\nform = 'r2p';\r\noutput1 = 5.0000;\r\noutput2 = 306.8699;\r\noutput = [output1;output2];\r\nassert(isequal(round(complexConverter(input1, input2, form),4),output))\r\n%%Test4\r\ninput1 = 7; %radius\r\ninput2 = 225; %degrees\r\nform = 'p2r';\r\noutput1 = -4.9497;\r\noutput2 = -4.9497;\r\noutput = [output1;output2];\r\nassert(isequal(round(complexConverter(input1, input2, form),4),output))","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":377536,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":31,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-28T03:12:54.000Z","updated_at":"2025-12-29T14:25:32.000Z","published_at":"2020-02-25T00:35: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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eBACKGROUND / MOTIVATION:\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\u003eComplex numbers can be an important tool in an electrical engineer's toolbox because they can help us describe / work with sinusoidal signals.\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\u003eSinusoidal signals can be found all over the place in day-to-day life (in music, light, communication systems, power systems, etc.):\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\u003e\\\"Why Study Sinusoids?\\\":\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.youtube.com/watch?v=yXjXJ5OlNyQ\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://www.youtube.com/watch?v=yXjXJ5OlNyQ\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\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\u003e\\\"Euler's formula\\\":\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.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-eulers-formula\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-eulers-formula\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\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\u003eWhen working with complex numbers, sometimes it's easier to work with the \\\"rectangular/Cartesian form\\\" (z = x + j*y) and sometimes it's easier to work with the \\\"polar form\\\" (r ∠ θ).\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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAn analogy:\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\u003eUsing the rectangular form is sometimes like using decimals: it can make the numbers easier to add / subtract\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\u003eUsing the polar form is sometimes like using fractions: it can the numbers easier to multiply / divide\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\u003eIn the end, the two forms are equivalent, but sometimes they're easier to work with in one form instead of another.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ePROBLEM DESCRIPTION\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 which converts between the rectangular form and the polar form.\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\u003eYou can view a comparison of the two forms here:\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.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-complex-numbers\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-complex-numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\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 variable \\\"form\\\" will be used to determine whether the function converts from rectangular to polar or from polar to rectangular.\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 function takes the following inputs:\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\u003e\\\"input1\\\" - a variable which is either \\\"x\\\" (the real component in rectangular form) or \\\"r\\\" (the radius in polar form)\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\u003e\\\"input2\\\" - a variable which is either \\\"y\\\" (the complex component in rectangular form) or \\\"theta\\\" (the angle, in degrees, in polar form)\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\u003e\\\"form\\\" - a variable which is set to either \\\"r2p\\\" (to convert from rectangular to polar) or \\\"p2r\\\" (to convert from polar to rectangular)\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 function will output the variable \\\"output\\\" in the form of a column vector [output1;output2] where:\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\u003e\\\"output1\\\" - a component of the output which is either \\\"x\\\" (the real component in rectangular form) or \\\"r\\\" (the radius in polar form)\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\u003e\\\"output2\\\" - a component of the output which is either \\\"y\\\" (the complex component in rectangular form) or \\\"theta\\\" (the positive angle, in degrees, in polar form)\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 test suite will round the components of your output vector to 4 decimal places.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eFEEDBACK\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\u003ePlease feel free to leave feedback on this problem in the comments! :)\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":44429,"title":"Ounces to Kilograms","description":"convert ounces to kilograms, easy","description_html":"\u003cp\u003econvert ounces to kilograms, easy\u003c/p\u003e","function_template":"function kg = your_fcn_name(oz)\r\n kg = oz;\r\nend","test_suite":"%%test 1\r\nx = 50;\r\ny_correct = 1.417475\r\nassert(abs(your_fcn_name(x)-y_correct) \u003c 1e-4)\r\n\r\n%%test 2\r\nx = 100;\r\ny_correct = 2.83495\r\nassert(abs(your_fcn_name(x)-y_correct) \u003c 1e-4)\r\n\r\n%%test 3\r\nx = 500;\r\ny_correct = 14.17475\r\nassert(abs(your_fcn_name(x)-y_correct) \u003c 1e-4)\r\n\r\n%%test 4\r\nx = 1000;\r\ny_correct = 28.3495\r\nassert(abs(your_fcn_name(x)-y_correct) \u003c 1e-4)","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":156466,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":109,"test_suite_updated_at":"2018-01-04T19:23:15.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-12-02T15:32:52.000Z","updated_at":"2026-02-18T21:56:29.000Z","published_at":"2017-12-02T15:32:52.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 ounces to kilograms, easy\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":1603,"title":"Temperature conversion","description":"Convert temperature in degrees Celsius (C) to temperature in degrees Kelvin (K). Assume your answer is rounded to the nearest Kelvin.","description_html":"\u003cp\u003eConvert temperature in degrees Celsius (C) to temperature in degrees Kelvin (K). Assume your answer is rounded to the nearest Kelvin.\u003c/p\u003e","function_template":"function tK = celsius_to_kelvin(tC)\r\n  tK = 0;\r\nend","test_suite":"%%\r\ntC = 1;\r\ntK_correct = 274;\r\nassert(isequal(celsius_to_kelvin(tC),tK_correct))\r\n\r\n%%\r\ntC = -273;\r\ntK_correct = 0;\r\nassert(isequal(celsius_to_kelvin(tC),tK_correct))\r\n\r\n%%\r\ntC = 100;\r\ntK_correct = 373;\r\nassert(isequal(celsius_to_kelvin(tC),tK_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":14498,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":552,"test_suite_updated_at":"2013-06-10T19:45:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-06-06T15:13:07.000Z","updated_at":"2026-02-16T12:14:15.000Z","published_at":"2013-06-10T14:56:51.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 temperature in degrees Celsius (C) to temperature in degrees Kelvin (K). Assume your answer is rounded to the nearest Kelvin.\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":55425,"title":"Convert a given Character to its decimal equivalent value","description":"Convert a given character to its decimal equivalent value according to the ascii table. \r\nif x = '!';    y = 33;\r\nif x = 'u';   y = 117;\r\nhttps://www.asciitable.com/\r\n","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=\"\"\u003eConvert a given character to its decimal equivalent value according to the ascii table. \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=\"\"\u003eif x = '!';    y = 33;\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=\"\"\u003eif x = 'u';   y = 117;\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=\"\"\u003ehttps://www.asciitable.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: 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\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = char2dec(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'T';\r\ny_correct = 84;\r\nassert(isequal(char2dec(x),y_correct))\r\n%%\r\nx = 'R';\r\ny_correct = 82;\r\nassert(isequal(char2dec(x),y_correct))\r\n%%\r\nx = 'U';\r\ny_correct = 85;\r\nassert(isequal(char2dec(x),y_correct))\r\n%%\r\nx = 'M';\r\ny_correct = 77;\r\nassert(isequal(char2dec(x),y_correct))\r\n%%\r\nx = 'P';\r\ny_correct = 80;\r\nassert(isequal(char2dec(x),y_correct))\r\n%%\r\nx = '!';\r\ny_correct = 33;\r\nassert(isequal(char2dec(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":48917,"edited_by":48917,"edited_at":"2022-09-02T19:18:34.000Z","deleted_by":null,"deleted_at":null,"solvers_count":65,"test_suite_updated_at":"2022-09-02T19:18:05.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-09-02T19:15:20.000Z","updated_at":"2026-02-18T21:41:37.000Z","published_at":"2022-09-02T19:18:05.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\u003eConvert a given character to its decimal equivalent value according to the ascii table. \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\u003eif x = '!';    y = 33;\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\u003eif x = 'u';   y = 117;\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\u003ehttps://www.asciitable.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\u003e\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":2215,"title":"Power supply: 230V to 115V","description":"The problem is simple: we have a wall outlet which supplies 230V and an apparatus that requires 115V.\r\n\r\nSoftware is always cheaper than hardware (well, most of the time), so we solve this with a program, a Matlab function, to be precise.\r\n\r\nWrite a program that converts the supplied input voltage to the required output voltage.\r\n\r\n*If you like this problem, please like it (after solving).*","description_html":"\u003cp\u003eThe problem is simple: we have a wall outlet which supplies 230V and an apparatus that requires 115V.\u003c/p\u003e\u003cp\u003eSoftware is always cheaper than hardware (well, most of the time), so we solve this with a program, a Matlab function, to be precise.\u003c/p\u003e\u003cp\u003eWrite a program that converts the supplied input voltage to the required output voltage.\u003c/p\u003e\u003cp\u003e\u003cb\u003eIf you like this problem, please like it (after solving).\u003c/b\u003e\u003c/p\u003e","function_template":"function V_out = transformer(V_in)\r\n  N_primary = 5432; % Number of windings on primary coil.\r\n  N_secondary = 2716; % Number of windings on secondary coil.\r\n  V_out = N_secondary*i*V_in/N_primary; % Volt\r\nend","test_suite":"%%\r\nx = 230;\r\ny = transformer(x);\r\ny_correct = 115;\r\nif ~isequal(y,y_correct)\r\ndisp('That is not correct!');\r\ndisp('ÆÆÆÆÆÆÆÆÆÆÆÆÈØ8áÿèqBDüaZF$TWËF®H0ÑÓKÛÆÆÆÈÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆ');\r\ndisp('ÆÆÆÆÆÆÆÉÔ$ÜWÃ§Xwí/+«}{}º°{×}pÔ¿*/\u0026v\u0026F§ÉgÁÂÔÔÔÆÆÆÆÆÆÆÆÆÆÆÆ');\r\ndisp('ÆÆÆÆÆÆÔÔpæ¼í¢rîC/ìn[**ª°\"²_!*\\\"_^¬ï7\u0026¼n/V2¼ÿ§ÖHÔÆÆÆÆÆÆÆÆÆ');\r\ndisp('ÆÆÆÆWÐ0õCtîv½»¬°\"¡^¬°³;:²-::÷\";^¬¬³°÷¬(}(}{I¾$ÖE¶MÈÆÆÆÆÆÆ');\r\ndisp('ÆÆÆÛP9{{{ï{}ª°³º°²ª²,:::¨¨¨¸'';::¹¹;²ª*{}|¬}íí\u003ct=åÚBÔÕÆÆÆÆ');\r\ndisp('ÆÆÆÐÿj\u0026£j{/»°°³\"_;;¹;:¸.¸¨¸¸¸¨,¨,''^^°¬¡\"ª¦¦{¿{î46bôBÆÈÑÕÆ');\r\ndisp('ÆÆÆÕKC¿}¦º~²²!^;:¨¸¨¸¨¸··´·.¸¨¸¸¸:;::~~¯°÷÷{(*\u003c}íIàãK¶ÑÑÆ');\r\ndisp('ÆÆÔMýwri¦¯;'':''::¨´.¨  ··  ···`¨¨:;,,¨¨,;²\"°°°\"_°÷{r±¼FÛÆÆ');\r\ndisp('ÆÆ§Tî{¬¬º\":;,¸´¸``.··  · ·····´.´···..`¸¨:;__^¯\"÷{i{zagWÈ');\r\ndisp('ÆÆÖ¼l|²²\"¬²;¸.···   · ·   ······´.¨:_²¨`¸¨:;_ª°¬°¦»}[uaßN');\r\ndisp('ÈÔ©n/÷º\"\"_,¸´····    ·········.´¸¨:::-¹;,::;^°*|{+}}}\u003eJ5F');\r\ndisp('ÆpIc}*«÷²_:¨¸¸`·   ´¸.········.``¸¸¨,;­;;;:;­²\"ª÷¦}»}vI6ë');\r\ndisp('Èdc+¦/}÷\"-:''¨`··  ¨,`.·········´¸¸¸¸,:;_^-::'''';_¡*¦«)t=Yå');\r\ndisp('ÔAu}÷÷¡ª²¹''¸`¸·  ·¨''`.·.·······´``¸¨¨,;­°~:¨¨:;¹;ª¦{|ízÏß');\r\ndisp('Ðs{÷¬º¬_¹;¨¨¸´···¨,''¸`··········`¸¨¨::;-¡º::'':­¹¹^¯^°ºí%p');\r\ndisp('Ëõî}¬¬ª¬;:,´····´,:,,`´´´.····.·´¸¨¨'':­_\"¦­,:::_°¬*°¡\"¬{Y');\r\ndisp('§øL?}}*ª¡²''¸``·´¸::::¨¨_*I}_¨...`¸,^[ôî\\¬{¬;;_^²º¦¬ï{]l}}');\r\ndisp('ß5]«¬°¦{¦^:_ª^_,¸::''²;::_~^~;;¨`¨;¯){ti¬ìïº;^+t¿}*°}i\\tcî');\r\ndisp('ÆS%î}}¦ïI¦^²\"¬°;¸::''­::°nÊÊª^~^¨;(°¬ÊÊLz}*÷;¬ï±sVÌx{»/{?]');\r\ndisp('ÉKg4{¬¦î¼}¯;:_;£ç¦²:''¸,²:²:,:¡~:;}-:;¡°÷°²?{ÂÝ¾5ï5ntÍruz6');\r\ndisp('®k+÷°º¿ii;,;¨¬¸^áIi°¸´`¸¸´·´¨­²­''º*¹:;__²°C+¾án%Iå%j{tI½ç');\r\ndisp('Îv³°+{uu±°;;:*\u003e\"lz{t_¸······¨;¬_¨;{\";::;-¦=\"\u003eïîpîZhtï£awD');\r\ndisp('j)¬×{rxÍ©i¡^*_?¬²Y}c¬:`.····''^{:¸¨¡÷::-²²}{»{}{Y±aYao¢ô®W');\r\ndisp('\u0026l{{?Jnîz¿¬°ª¯lf¬C?ï°::¨´··¸:¬¿¬:;{}:::²°)JYjrYzADhZdÐ#ÆÆ');\r\ndisp('LÌl11îIì[ï°~~°~{ÞÊ©±*,::`.¸'':²²i±¼¦ª~^;²º[ÈÔÆmzôG§ÓÓ¶ÛÔÈÆ');\r\ndisp('WDîî{ïuîv]°\"^«¦÷¿àÕ§/¹::¸¨ªCPEGõ½ð®YCv¬\"}ÔÊÊÊÊËÓèÖÕÔÔÉÆÆÆ');\r\ndisp('ÈÔë±zI[{{÷\"ª°º*{zøÔÊ§¹;­'':\u0026I]tnu}Î¾n¦{\"÷1ÊÊÊÊÊÊÔ®ÖÆÆÆÆÆÆÆ');\r\ndisp('ÆÆÔK\u0026I\\*{*«*¦{{¿±ÆÊÊÊÕ÷°ª;;­:;­²^_­;-°}DÊÊÊÊÊÊÊÊÊÊÆÆÆÆÆÆÆ');\r\ndisp('ÆÆÆ#¶©x/il\\tîofbÊÊÊÊÊÊÊMz?²²;:¨¸¸¸'';ª¾ÊIÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÆË');\r\ndisp('ÆÆÆÆÆÆÖÐMÖdøFsÉÊÊÊÊÊÊÊªÎÆÊÊÖJ°-;-_²uÊV;MÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÆÆÆÆÆÆÆÆÆÆÈÈÊÊÊÊÊÊÊÊÊÊÊz··!3ÊÊÊÆMËÊë² vÊÔÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÆÆÆÆÆÆÆÆÆÆÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÖ¿  ·;¬÷²¸   ¦ÊÅÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÆÆÆÆÆÆÆÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ·  ·*42/\u0026bî^:¿ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÆÆÆÆÆÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ:´-ÊÊÊÊÊÊÖÔ^  ½ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÆÆËÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ· :ëÊÊÊÊÊÊ¬  PÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ   ²ÞÊÊÊÊÝ  WÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÉ    {ÊÊÊÊ² ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÅ   ¹ÊÊÊÊÊ:ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊg  µÊÊÊÊËÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ8·gÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('Is this problem a hair-raiser?');\r\nend\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\n% On request of Ned Gulley, some extra testcases (for the, hopefully, stable voltage regulator within the input voltage range specified on the box).\r\nassert(isequal(transformer(173),115))\r\nassert(isequal(transformer(225),115))\r\nassert(isequal(transformer(145),115))\r\nassert(isequal(transformer(238),115))\r\nassert(isequal(transformer(163),115))\r\nassert(isequal(transformer(128),115))\r\nassert(isequal(transformer(216),115))\r\nassert(isequal(transformer(164),115))\r\nassert(isequal(transformer(136),115))\r\nassert(isequal(transformer(156),115))\r\nassert(isequal(transformer(166),115))\r\nassert(isequal(transformer(132),115))\r\nassert(isequal(transformer(162),115))\r\nassert(isequal(transformer(227),115))\r\nassert(isequal(transformer(203),115))\r\nassert(isequal(transformer(168),115))\r\nassert(isequal(transformer(174),115))\r\nassert(isequal(transformer(170),115))\r\nassert(isequal(transformer(161),115))\r\nassert(isequal(transformer(226),115))\r\nassert(isequal(transformer(232),115))\r\nassert(isequal(transformer(146),115))\r\nassert(isequal(transformer(151),115))\r\nassert(isequal(transformer(152),115))\r\nassert(isequal(transformer(193),115))\r\nassert(isequal(transformer(201),115))\r\nassert(isequal(transformer(192),115))\r\nassert(isequal(transformer(133),115))\r\nassert(isequal(transformer(137),115))\r\nassert(isequal(transformer(224),115))\r\nassert(isequal(transformer(200),115))\r\nassert(isequal(transformer(221),115))\r\nassert(isequal(transformer(160),115))\r\nassert(isequal(transformer(230),115))\r\nassert(isequal(transformer(176),115))\r\nassert(isequal(transformer(210),115))\r\nassert(isequal(transformer(159),115))\r\nassert(isequal(transformer(177),115))\r\nassert(isequal(transformer(126),115))\r\nassert(isequal(transformer(197),115))\r\nassert(isequal(transformer(141),115))\r\nassert(isequal(transformer(222),115))\r\nassert(isequal(transformer(189),115))\r\nassert(isequal(transformer(223),115))\r\nassert(isequal(transformer(140),115))\r\nassert(isequal(transformer(231),115))\r\nassert(isequal(transformer(236),115))\r\nassert(isequal(transformer(180),115))\r\nassert(isequal(transformer(191),115))\r\nassert(isequal(transformer(149),115))\r\nassert(isequal(transformer(172),115))\r\nassert(isequal(transformer(196),115))\r\nassert(isequal(transformer(135),115))\r\nassert(isequal(transformer(209),115))\r\nassert(isequal(transformer(144),115))\r\nassert(isequal(transformer(233),115))\r\nassert(isequal(transformer(215),115))\r\nassert(isequal(transformer(204),115))\r\nassert(isequal(transformer(187),115))\r\nassert(isequal(transformer(202),115))\r\nassert(isequal(transformer(217),115))\r\nassert(isequal(transformer(171),115))\r\nassert(isequal(transformer(153),115))\r\nassert(isequal(transformer(139),115))\r\nassert(isequal(transformer(148),115))\r\nassert(isequal(transformer(169),115))\r\nassert(isequal(transformer(130),115))\r\nassert(isequal(transformer(219),115))\r\nassert(isequal(transformer(206),115))\r\nassert(isequal(transformer(127),115))\r\nassert(isequal(transformer(129),115))\r\nassert(isequal(transformer(218),115))\r\nassert(isequal(transformer(220),115))\r\nassert(isequal(transformer(213),115))\r\nassert(isequal(transformer(207),115))\r\nassert(isequal(transformer(188),115))\r\nassert(isequal(transformer(179),115))\r\nassert(isequal(transformer(185),115))\r\nassert(isequal(transformer(131),115))\r\nassert(isequal(transformer(157),115))\r\nassert(isequal(transformer(143),115))\r\nassert(isequal(transformer(147),115))\r\nassert(isequal(transformer(138),115))\r\nassert(isequal(transformer(214),115))\r\nassert(isequal(transformer(178),115))\r\nassert(isequal(transformer(182),115))\r\nassert(isequal(transformer(195),115))\r\nassert(isequal(transformer(237),115))\r\nassert(isequal(transformer(155),115))\r\nassert(isequal(transformer(158),115))\r\nassert(isequal(transformer(199),115))\r\nassert(isequal(transformer(211),115))\r\nassert(isequal(transformer(228),115))\r\nassert(isequal(transformer(175),115))\r\nassert(isequal(transformer(150),115))\r\nassert(isequal(transformer(194),115))\r\nassert(isequal(transformer(134),115))\r\nassert(isequal(transformer(229),115))\r\nassert(isequal(transformer(181),115))\r\nassert(isequal(transformer(190),115))\r\nassert(isequal(transformer(165),115))\r\nassert(isequal(transformer(235),115))\r\nassert(isequal(transformer(239),115))\r\nassert(isequal(transformer(212),115))\r\nassert(isequal(transformer(208),115))\r\nassert(isequal(transformer(142),115))\r\nassert(isequal(transformer(198),115))\r\nassert(isequal(transformer(184),115))\r\nassert(isequal(transformer(240),115))\r\nassert(isequal(transformer(205),115))\r\nassert(isequal(transformer(234),115))\r\nassert(isequal(transformer(186),115))\r\nassert(isequal(transformer(183),115))\r\nassert(isequal(transformer(167),115))\r\nassert(isequal(transformer(154),115))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":6556,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":108,"test_suite_updated_at":"2014-02-26T08:04:49.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-02-24T15:36:09.000Z","updated_at":"2026-02-18T14:03:38.000Z","published_at":"2014-02-24T15:36:09.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\u003eThe problem is simple: we have a wall outlet which supplies 230V and an apparatus that requires 115V.\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\u003eSoftware is always cheaper than hardware (well, most of the time), so we solve this with a program, a Matlab function, to be precise.\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 program that converts the supplied input voltage to the required output voltage.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eIf you like this problem, please like it (after solving).\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":43830,"title":"MPS to MPH","description":"Given the speed in miles per second, find the speed in miles per hour.","description_html":"\u003cp\u003eGiven the speed in miles per second, find the speed in miles per hour.\u003c/p\u003e","function_template":"function mph = MPS2MPH(mps)\r\n  mph;\r\nend","test_suite":"%%\r\nmps = 40;\r\nmph_correct = 144000;\r\nassert(isequal(MPS2MPH(mps),mph_correct))\r\n\r\n%%\r\nmps = 5000;\r\nmph_correct = 18000000;\r\nassert(isequal(MPS2MPH(mps),mph_correct))\r\n\r\n%%\r\nmps = 186218;\r\nmph_correct = 670384800;\r\nassert(isequal(MPS2MPH(mps),mph_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":100606,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":158,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-12-17T04:03:25.000Z","updated_at":"2026-02-17T17:54:06.000Z","published_at":"2016-12-17T04:03:44.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\u003eGiven the speed in miles per second, find the speed in miles per hour.\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":49037,"title":"Temperature Conversion 1","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 10.5px; transform-origin: 332px 10.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: 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=\"\"\u003eGiven a temperature in Celcius, please convert it to Kelvin.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x-x^2;\r\nend","test_suite":"%%\r\nx = 0;\r\ny_correct = 273.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 10;\r\ny_correct = 283.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = -273.15;\r\ny_correct = 0;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 25;\r\ny_correct = 298.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 101;\r\ny_correct = 374.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = -3.15;\r\ny_correct = 270;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":16,"comments_count":1,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1797,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:30:19.000Z","updated_at":"2026-04-08T20:21:57.000Z","published_at":"2020-12-22T21:30:19.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\u003eGiven a temperature in Celcius, please convert it to Kelvin.\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":49052,"title":"Temperature Conversion 3","description":"Given a temperature in Celcius, convert it to Fahrenheit.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.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 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: 177px 8px; transform-origin: 177px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a temperature in Celcius, convert it to Fahrenheit.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x*7/3+66;\r\nend","test_suite":"%%\r\nfiletext = fileread('convert_stuff.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || ...\r\n          contains(filetext, 'switch') || contains(filetext, 'if'); \r\nassert(~illegal)\r\n%%\r\nx = 0;\r\ny_correct = 32;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 5;\r\ny_correct = 41;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 20;\r\ny_correct = 68;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 40;\r\ny_correct = 104;\r\nassert(isequal(convert_stuff(x),y_correct))","published":true,"deleted":false,"likes_count":10,"comments_count":0,"created_by":180632,"edited_by":223089,"edited_at":"2022-12-11T07:11:44.000Z","deleted_by":null,"deleted_at":null,"solvers_count":1668,"test_suite_updated_at":"2022-12-11T07:11:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:41:39.000Z","updated_at":"2026-04-08T16:56:56.000Z","published_at":"2020-12-22T21:41:39.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\u003eGiven a temperature in Celcius, convert it to Fahrenheit.\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":2997,"title":"Kelvin to Celsius","description":"Degrees Celsius = degrees Kelvin - 273.15.\r\n\r\nGiven a temperature in Kelvin, return the equivalent temperature in Celsius.","description_html":"\u003cp\u003eDegrees Celsius = degrees Kelvin - 273.15.\u003c/p\u003e\u003cp\u003eGiven a temperature in Kelvin, return the equivalent temperature in Celsius.\u003c/p\u003e","function_template":"function y = kelvin(x)\r\n  y = x - 273.15 ;\r\nend","test_suite":"%%\r\nx = 360;\r\ny_correct = 86.85;\r\nassert(isequal(kelvin(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":35805,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":190,"test_suite_updated_at":"2015-02-10T22:22:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-02-10T22:15:31.000Z","updated_at":"2026-02-18T15:17:47.000Z","published_at":"2015-02-10T22:22:14.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\u003eDegrees Celsius = degrees Kelvin - 273.15.\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 a temperature in Kelvin, return the equivalent temperature in Celsius.\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":43215,"title":"Convert radians to degrees","description":"Given input in radians, output to degrees","description_html":"\u003cp\u003eGiven input in radians, output to degrees\u003c/p\u003e","function_template":"function y = RAD2DEG(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = pi;\r\ny_correct = 180;\r\nassert(abs(RAD2DEG(x)-y_correct)\u003c0.01)\r\n%%\r\nx = -pi;\r\ny_correct = -180;\r\nassert(abs(RAD2DEG(x)-y_correct)\u003c0.01)\r\n%%\r\nx = pi/2;\r\ny_correct = 90;\r\nassert(abs(RAD2DEG(x)-y_correct)\u003c0.01)\r\n%%\r\nx = pi/4;\r\ny_correct = 45;\r\nassert(abs(RAD2DEG(x)-y_correct)\u003c0.01)\r\n","published":true,"deleted":false,"likes_count":16,"comments_count":0,"created_by":13865,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2555,"test_suite_updated_at":"2016-10-29T16:53:32.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-08T10:09:08.000Z","updated_at":"2026-04-07T02:02:44.000Z","published_at":"2016-10-08T10:09:08.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\u003eGiven input in radians, output to degrees\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":44428,"title":"lb to kilogram","description":"convert lb to kilogram units, easy","description_html":"\u003cp\u003econvert lb to kilogram units, easy\u003c/p\u003e","function_template":"function kg = your_fcn_name(lb)\r\n  y = x;\r\nend","test_suite":"%%test 1\r\nx = 50;\r\ny_correct = 22.6796;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%% test 2\r\nx = 100;\r\ny_correct = 45.3592;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%test 3\r\nx = 500;\r\ny_correct = 226.7960;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":156466,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":97,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2017-12-02T15:19:47.000Z","updated_at":"2026-02-18T15:30:10.000Z","published_at":"2017-12-02T15:19:47.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 lb to kilogram units, easy\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":49047,"title":"Temperature Conversion 2","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 10.5px; transform-origin: 332px 10.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: 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=\"\"\u003eGiven a temperature in Fahrenheit, convert it to Kelvin\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x+sin(x);\r\nend","test_suite":"%%\r\nx = 32;\r\ny_correct = 273.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 68;\r\ny_correct = 293.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 104;\r\ny_correct = 313.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":8,"comments_count":2,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1655,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:38:47.000Z","updated_at":"2026-04-08T16:56:26.000Z","published_at":"2020-12-22T21:38:47.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\u003eGiven a temperature in Fahrenheit, convert it to Kelvin\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":1338,"title":"Binary Coder","description":"Take an input number and print the binary value of this number.","description_html":"\u003cp\u003eTake an input number and print the binary value of this number.\u003c/p\u003e","function_template":"function y = binary_coder(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 8;\r\ny_correct = 1000;\r\nassert(isequal(binary_coder(x),y_correct))\r\n\r\n%%\r\nx = 24;\r\ny_correct = 11000;\r\nassert(isequal(binary_coder(x),y_correct))","published":true,"deleted":false,"likes_count":6,"comments_count":0,"created_by":11534,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":273,"test_suite_updated_at":"2013-03-10T18:56:12.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-03-10T18:19:00.000Z","updated_at":"2026-03-27T18:21:15.000Z","published_at":"2013-03-10T18:19:00.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\u003eTake an input number and print the binary value of this number.\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":43672,"title":"String Array Basics, Part 2: Convert String Array to Cell Array; No Missing Values","description":"\u003chttp://www.mathworks.com/help/matlab/characters-and-strings.html String array\u003e and cell array are two types of containers for storing pieces of data. In this problem, you will be given a string array. Your job is to convert the string array to a cell array of character vectors, which stores the same pieces of text data.\r\n\r\nTo begin with, let's assume that there are no missing type values in the input string array. \r\n\r\nExample: \r\n\r\n  Input:\r\n  \u003e\u003e x = string({'I','love','MATLAB'})\r\n  x = \r\n    1×3 string array\r\n      \"I\"    \"love\"    \"MATLAB\";\r\n\r\n  Output:\r\n  \u003e\u003e y = {'I','love','MATLAB'}\r\n  y =\r\n    1×3 cell array\r\n      'I'    'love'    'MATLAB';\r\n\r\nRelated Problems in this series:\r\n\r\n* \u003chttp://www.mathworks.com/matlabcentral/cody/problems/43677-string-array-basics-part-1-convert-cell-array-to-string-array-no-missing-values   String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values\u003e \r\n* String Array Basics, Part 2: Convert String Array to Cell Array; No Missing Values\r\n* \u003chttp://www.mathworks.com/matlabcentral/cody/problems/43674-string-array-basics-part-3-convert-cell-array-to-string-array-with-missing-values   String Array Basics, Part 3: Convert Cell Array with Missing Values to String Array\u003e\r\n* \u003chttp://www.mathworks.com/matlabcentral/cody/problems/43673-string-array-basics-part-4-convert-string-array-to-cell-array-with-missing-values   String Array Basics, Part 4: Convert String Array with Missing Values to Cell Array\u003e","description_html":"\u003cp\u003e\u003ca href = \"http://www.mathworks.com/help/matlab/characters-and-strings.html\"\u003eString array\u003c/a\u003e and cell array are two types of containers for storing pieces of data. In this problem, you will be given a string array. Your job is to convert the string array to a cell array of character vectors, which stores the same pieces of text data.\u003c/p\u003e\u003cp\u003eTo begin with, let's assume that there are no missing type values in the input string array.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eInput:\r\n\u0026gt;\u0026gt; x = string({'I','love','MATLAB'})\r\nx = \r\n  1×3 string array\r\n    \"I\"    \"love\"    \"MATLAB\";\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eOutput:\r\n\u0026gt;\u0026gt; y = {'I','love','MATLAB'}\r\ny =\r\n  1×3 cell array\r\n    'I'    'love'    'MATLAB';\r\n\u003c/pre\u003e\u003cp\u003eRelated Problems in this series:\u003c/p\u003e\u003cul\u003e\u003cli\u003e\u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/43677-string-array-basics-part-1-convert-cell-array-to-string-array-no-missing-values\"\u003eString Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values\u003c/a\u003e\u003c/li\u003e\u003cli\u003eString Array Basics, Part 2: Convert String Array to Cell Array; No Missing Values\u003c/li\u003e\u003cli\u003e\u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/43674-string-array-basics-part-3-convert-cell-array-to-string-array-with-missing-values\"\u003eString Array Basics, Part 3: Convert Cell Array with Missing Values to String Array\u003c/a\u003e\u003c/li\u003e\u003cli\u003e\u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/43673-string-array-basics-part-4-convert-string-array-to-cell-array-with-missing-values\"\u003eString Array Basics, Part 4: Convert String Array with Missing Values to Cell Array\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e","function_template":"function y = str2cell(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = string({'I','love','MATLAB'});\r\ny_correct = {'I','love','MATLAB'};\r\nassert(isequal(str2cell(x),y_correct))\r\n\r\n%%\r\nx = string({'I','love','MATLAB';'I','love','Cody'});\r\ny_correct = {'I','love','MATLAB'\r\n             'I','love','Cody'};\r\nassert(isequal(str2cell(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":12569,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":153,"test_suite_updated_at":"2016-11-23T06:40:34.000Z","rescore_all_solutions":false,"group_id":16,"created_at":"2016-11-21T01:00:23.000Z","updated_at":"2026-03-10T19:51:47.000Z","published_at":"2016-11-22T21:10:09.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:hyperlink w:docLocation=\\\"http://www.mathworks.com/help/matlab/characters-and-strings.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eString array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and cell array are two types of containers for storing pieces of data. In this problem, you will be given a string array. Your job is to convert the string array to a cell array of character vectors, which stores the same pieces of text data.\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\u003eTo begin with, let's assume that there are no missing type values in the input string array.\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\u003eExample:\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[Input:\\n\u003e\u003e x = string({'I','love','MATLAB'})\\nx = \\n  1×3 string array\\n    \\\"I\\\"    \\\"love\\\"    \\\"MATLAB\\\";\\n\\nOutput:\\n\u003e\u003e y = {'I','love','MATLAB'}\\ny =\\n  1×3 cell array\\n    'I'    'love'    'MATLAB';]]\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\u003eRelated Problems in this series:\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/43677-string-array-basics-part-1-convert-cell-array-to-string-array-no-missing-values\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eString Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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\u003eString Array Basics, Part 2: Convert String Array to Cell Array; No Missing Values\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/43674-string-array-basics-part-3-convert-cell-array-to-string-array-with-missing-values\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eString Array Basics, Part 3: Convert Cell Array with Missing Values to String Array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/43673-string-array-basics-part-4-convert-string-array-to-cell-array-with-missing-values\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eString Array Basics, Part 4: Convert String Array with Missing Values to Cell Array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":2204,"title":"Convert a vector of Integers into a matrix of binaries","description":"Convert a vector of positive integers into a matrix containing their binary representation. Each column of the output contains the binary representation. The least significant bit is at the top.\r\n\r\nExample\r\n\r\n input  = [1 2 3 4]\r\n\r\n output = [1 0 1 0\r\n           0 1 1 0\r\n           0 0 0 1]\r\n","description_html":"\u003cp\u003eConvert a vector of positive integers into a matrix containing their binary representation. Each column of the output contains the binary representation. The least significant bit is at the top.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e input  = [1 2 3 4]\u003c/pre\u003e\u003cpre\u003e output = [1 0 1 0\r\n           0 1 1 0\r\n           0 0 0 1]\u003c/pre\u003e","function_template":"function y = MakeBitPattern(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [1 2 3 4 5];\r\ny_correct = [1     0     1     0     1;...\r\n             0     1     1     0     0;...\r\n             0     0     0     1     1];\r\nassert(isequal(MakeBitPattern(x),y_correct))\r\n\r\n%%\r\nx = [1 15];\r\ny_correct = [1     1;...\r\n             0     1;...\r\n             0     1;...\r\n             0     1];\r\nassert(isequal(MakeBitPattern(x),y_correct))\r\n\r\n%%\r\nx = [255 127 63 31 15 7 3 1];\r\ny_correct = [1     1     1     1     1     1     1     1;...\r\n             1     1     1     1     1     1     1     0;...\r\n             1     1     1     1     1     1     0     0;...\r\n             1     1     1     1     1     0     0     0;...\r\n             1     1     1     1     0     0     0     0;...\r\n             1     1     1     0     0     0     0     0;...\r\n             1     1     0     0     0     0     0     0;...\r\n             1     0     0     0     0     0     0     0]\r\nassert(isequal(MakeBitPattern(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":9342,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":81,"test_suite_updated_at":"2018-10-18T06:30:32.000Z","rescore_all_solutions":true,"group_id":45,"created_at":"2014-02-21T14:40:25.000Z","updated_at":"2026-03-24T13:34:30.000Z","published_at":"2014-02-21T14:54: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\",\"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\u003eConvert a vector of positive integers into a matrix containing their binary representation. Each column of the output contains the binary representation. The least significant bit is at the top.\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\u003eExample\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[ input  = [1 2 3 4]\\n\\n output = [1 0 1 0\\n           0 1 1 0\\n           0 0 0 1]]]\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":49082,"title":"Energy Conversion 1","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.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 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: 239px 8px; transform-origin: 239px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven an energy in the unit of BTU (British Thermal Unit), convert it to Joule.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x+273.15;\r\nend","test_suite":"%%\r\nx = 123;\r\ny_correct = 129772.38;\r\nassert(abs(convert_stuff(x)-y_correct)\u003c1e-4)\r\n\r\n%%\r\nx = 0.015;\r\ny_correct = 15.8259;\r\nassert(abs(convert_stuff(x)-y_correct)\u003c1e-4)\r\n\r\n%%\r\nx = 66.3;\r\ny_correct = 69950.478;\r\nassert(abs(convert_stuff(x)-y_correct)\u003c1e-4)","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1039,"test_suite_updated_at":"2021-03-22T11:36:52.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T22:07:55.000Z","updated_at":"2026-04-08T21:05:41.000Z","published_at":"2020-12-22T22:07:55.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\u003eGiven an energy in the unit of BTU (British Thermal Unit), convert it to Joule.\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":8045,"title":"Gold Standard","description":"Gold has long been used as currency and a standard for currency, due to its inherent value and rarity. Historical data for gold is available at \u003chttp://measuringworth.com/gold/ Measuring Worth\u003e.\r\n\r\nFor this problem, you will be provided with a historical year (HY) and a historical value (HV) in dollars. The function template includes data from the previously mentioned site for the value (in dollars) of an ounce of gold (GV) from 1791 to 2014. Write a function to determine the current value (CV) in dollars assuming that the gold standard can be accurately used to convert between years. Round the result to two decimal places. If HY is outside of the historical-data range, return NaN.\r\n\r\nAs an example, with HY = 2000 and HV = 1000:\r\n\r\n* GV(HY=2000) = $280.10\r\n* N = 1000/280.10 = 3.57 (ounces of gold)\r\n* CV = 3.57*1270 (current $/ounce of gold) = $4534.09.\r\n","description_html":"\u003cp\u003eGold has long been used as currency and a standard for currency, due to its inherent value and rarity. Historical data for gold is available at \u003ca href = \"http://measuringworth.com/gold/\"\u003eMeasuring Worth\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eFor this problem, you will be provided with a historical year (HY) and a historical value (HV) in dollars. The function template includes data from the previously mentioned site for the value (in dollars) of an ounce of gold (GV) from 1791 to 2014. Write a function to determine the current value (CV) in dollars assuming that the gold standard can be accurately used to convert between years. Round the result to two decimal places. If HY is outside of the historical-data range, return NaN.\u003c/p\u003e\u003cp\u003eAs an example, with HY = 2000 and HV = 1000:\u003c/p\u003e\u003cul\u003e\u003cli\u003eGV(HY=2000) = $280.10\u003c/li\u003e\u003cli\u003eN = 1000/280.10 = 3.57 (ounces of gold)\u003c/li\u003e\u003cli\u003eCV = 3.57*1270 (current $/ounce of gold) = $4534.09.\u003c/li\u003e\u003c/ul\u003e","function_template":"function [CV] = gold_standard(HY,HV)\r\n\r\nY = 1791:2014;\r\nGV = [19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 20.1, 21.64, 20.95, 19.46, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.94, 20.69, 20.69, 21.64, 20.86, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.7, 20.67, 20.67, 20.67, 20.67, 23.42, 30.02, 42.03, 32.52, 29.13, 28.57, 28.88, 27.49, 23.75, 23.09, 23.24, 23.52, 22.99, 23.75, 23.05, 21.66, 20.84, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 24.44, 34.94, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 39.26, 41.51, 36.41, 41.25, 58.6, 97.81, 159.74, 161.49, 125.32, 148.31, 193.55, 307.5, 612.56, 459.64, 375.91, 424, 360.66, 317.66, 368.24, 447.95, 438.31, 382.58, 384.93, 363.29, 344.97, 360.91, 385.42, 385.5, 389.09, 332.39, 295.24, 279.91, 280.1, 272.22, 311.33, 364.8, 410.52, 446, 606, 699, 874, 975, 1227, 1572, 1700, 1415, 1270];\r\n\r\nCV = 1;\r\n\r\nend\r\n","test_suite":"%% current check\r\nHY = 2014; HV = 1270; CV_corr = 1270;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%% out-of-range check 1\r\nHY = 500; HV = 50; CV_corr = NaN;\r\nassert(isnan(gold_standard(HY,HV)))\r\n\r\n%% out-of-range check 2\r\nHY = 2500; HV = 5000; CV_corr = NaN;\r\nassert(isnan(gold_standard(HY,HV)))\r\n\r\n%%\r\nHY = 2010; HV = 1000; CV_corr = 1035.04;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 2005; HV = 1000; CV_corr = 2847.53;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 2000; HV = 1000; CV_corr = 4534.09;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1995; HV = 1000; CV_corr = 3294.42;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1990; HV = 1000; CV_corr = 3299.3;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1950; HV = 1000; CV_corr = 36285.71;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1900; HV = 1000; CV_corr = 61441.7;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1850; HV = 1000; CV_corr = 61441.7;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1800; HV = 1000; CV_corr = 65497.68;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":63,"test_suite_updated_at":"2015-03-30T16:49:21.000Z","rescore_all_solutions":false,"group_id":30,"created_at":"2015-03-30T15:58:58.000Z","updated_at":"2026-03-24T03:34:47.000Z","published_at":"2015-03-30T15:58: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\u003eGold has long been used as currency and a standard for currency, due to its inherent value and rarity. Historical data for gold is available at\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://measuringworth.com/gold/\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMeasuring Worth\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\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor this problem, you will be provided with a historical year (HY) and a historical value (HV) in dollars. The function template includes data from the previously mentioned site for the value (in dollars) of an ounce of gold (GV) from 1791 to 2014. Write a function to determine the current value (CV) in dollars assuming that the gold standard can be accurately used to convert between years. Round the result to two decimal places. If HY is outside of the historical-data range, return NaN.\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\u003eAs an example, with HY = 2000 and HV = 1000:\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\u003eGV(HY=2000) = $280.10\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\u003eN = 1000/280.10 = 3.57 (ounces of gold)\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\u003eCV = 3.57*1270 (current $/ounce of gold) = $4534.09.\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":540,"title":"Convert hex color specification to MATLAB RGB","description":"Here's something that comes up all the time if you deal with web pages.\r\n\r\nGiven a \u003chttp://www.w3schools.com/html/html_colors.asp hexadecimal color specification\u003e of the form #FFFFFF, convert it to a 3 element MATLAB color specification. Remember that MATLAB RGB color values are between 0 and 1.\r\n\r\nThe input is a string starting with '#'. The output should be a 1-by-3 vector.\r\n\r\nExamples:\r\n\r\n Input  '#0000FF'\r\n Output [0 0 1]\r\n \r\n Input  '#33FF00'\r\n Output [0.2 1 0]","description_html":"\u003cp\u003eHere's something that comes up all the time if you deal with web pages.\u003c/p\u003e\u003cp\u003eGiven a \u003ca href=\"http://www.w3schools.com/html/html_colors.asp\"\u003ehexadecimal color specification\u003c/a\u003e of the form #FFFFFF, convert it to a 3 element MATLAB color specification. Remember that MATLAB RGB color values are between 0 and 1.\u003c/p\u003e\u003cp\u003eThe input is a string starting with '#'. The output should be a 1-by-3 vector.\u003c/p\u003e\u003cp\u003eExamples:\u003c/p\u003e\u003cpre\u003e Input  '#0000FF'\r\n Output [0 0 1]\u003c/pre\u003e\u003cpre\u003e Input  '#33FF00'\r\n Output [0.2 1 0]\u003c/pre\u003e","function_template":"function rgb = color_hex2rgb(hex)\r\n  rgb = [0 0 0];\r\nend","test_suite":"%%\r\nhex =  '#0000FF';\r\nrgb = [0 0 1];\r\nassert(isequal(color_hex2rgb(hex),rgb))\r\n\r\n%%\r\nhex =  '#33FF00';\r\nrgb = [0.2 1 0];\r\nassert(isequal(color_hex2rgb(hex),rgb))\r\n\r\n%%\r\nhex =  '#FFCCFF';\r\nrgb = [1 0.8 1];\r\nassert(isequal(color_hex2rgb(hex),rgb))\r\n\r\n%%\r\nhex =  '#999999';\r\nrgb = [.6 .6 .6];\r\nassert(isequal(color_hex2rgb(hex),rgb))","published":true,"deleted":false,"likes_count":7,"comments_count":0,"created_by":7,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":257,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-30T18:18:52.000Z","updated_at":"2026-04-09T08:38:53.000Z","published_at":"2012-03-30T18:26: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\u003eHere's something that comes up all the time if you deal with web pages.\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\u003eGiven a\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.w3schools.com/html/html_colors.asp\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehexadecimal color specification\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e of the form #FFFFFF, convert it to a 3 element MATLAB color specification. Remember that MATLAB RGB color values are between 0 and 1.\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 input is a string starting with '#'. The output should be a 1-by-3 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExamples:\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[ Input  '#0000FF'\\n Output [0 0 1]\\n\\n Input  '#33FF00'\\n Output [0.2 1 0]]]\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":49077,"title":"Velocity Conversion ","description":"Given a velocity in mph, convert it to km/h. Round the answer to the fourth decimal place.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20px; 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: normal; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"display: block; min-width: 0px; padding-top: 0px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eGiven a velocity in mph, convert it to km/h. Round the answer to the fourth decimal place.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x*fast;\r\nend","test_suite":"%%\r\nx = 11;\r\ny_correct = 17.7027;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 45;\r\ny_correct = 72.4203;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 80;\r\ny_correct = 128.7472;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":10,"comments_count":8,"created_by":180632,"edited_by":26769,"edited_at":"2022-04-12T14:19:48.000Z","deleted_by":null,"deleted_at":null,"solvers_count":1669,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T22:04:31.000Z","updated_at":"2026-04-08T21:01:26.000Z","published_at":"2020-12-22T22:04:31.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\u003eGiven a velocity in mph, convert it to km/h. Round the answer to the fourth decimal place.\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":45327,"title":"Decimal to binary conversion (without using built-in function)","description":"convert the given decimal number to its equivalent binary without using built-in function.\r\n\r\n* n=18\r\n* out='10010'","description_html":"\u003cp\u003econvert the given decimal number to its equivalent binary without using built-in function.\u003c/p\u003e\u003cul\u003e\u003cli\u003en=18\u003c/li\u003e\u003cli\u003eout='10010'\u003c/li\u003e\u003c/ul\u003e","function_template":"function y = bin_conv(d)\r\n  y = x;\r\nend","test_suite":"%%\r\nassert(isequal(bin_conv(17),dec2bin(17)))\r\n%%\r\nassert(isequal(bin_conv(2),dec2bin(2)))\r\n%%\r\nassert(isequal(bin_conv(107),dec2bin(107)))\r\n%%\r\nassert(isequal(bin_conv(223),dec2bin(223)))\r\n%%\r\nassert(isequal(bin_conv(2437),dec2bin(2437)))\r\n%%\r\nassert(isequal(bin_conv(55),dec2bin(55)))\r\n%%\r\nassert(isequal(bin_conv(55.55),dec2bin(55.55)))\r\n%%\r\nfiletext = fileread('bin_conv.m');\r\nassert(isempty(strfind(filetext, 'dec2bin')),'dec2bin() forbidden')\r\nassert(isempty(strfind(filetext, 'de2bi')),'de2bi() forbidden')\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2020-02-14T20:11:13.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-02-14T20:03:27.000Z","updated_at":"2026-02-21T13:51:55.000Z","published_at":"2020-02-14T20:11:13.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\u003econvert the given decimal number to its equivalent binary without using built-in function.\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\u003en=18\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\u003eout='10010'\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":60782,"title":"Convert integers from primary notation to base 10 ","description":"The primary system of expressing numbers has three digits: m, x, and p, which correspond to -1, 0, and 1. The places in a primary number correspond to the prime numbers. For example, the number 6 could be ppm in primary notation because . Similarly, the number 20 could be ppxxp in primary notation. \r\nBecause integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a number can exist. Cody Problem 60783 deals with proper primary notation.  \r\nWrite a function to convert integers expressed in primary notation to base 10. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 145.5px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 72.75px; transform-origin: 407px 72.75px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 64.5px; 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 32.25px; text-align: left; transform-origin: 384px 32.25px; white-space-collapse: preserve; 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: 14.5px 8px; transform-origin: 14.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe \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: 25.5px 8px; transform-origin: 25.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eprimary \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: 150px 8px; transform-origin: 150px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003esystem of expressing numbers has three digits: \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: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003em\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: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \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: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003ex\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: 18px 8px; transform-origin: 18px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, 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: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003ep\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: 160px 8px; transform-origin: 160px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, which correspond to -1, 0, and 1. The places in a primary number correspond to the prime numbers. For example, the number 6 could be \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: 12px 8px; transform-origin: 12px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 12px 8.5px; transform-origin: 12px 8.5px; \"\u003eppm\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: 91.5px 8px; transform-origin: 91.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in primary notation because \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUYAAAAlCAYAAAA+wECwAAAIV0lEQVR4Xu2dTeh3QxTHPXsSViwoLIiw8BaxkCgloRCSIi8LWcgTFpKEsJGFl1KS95KUlJcsSHkthVigSJ6Vt9hzPnVPzXP73Tuvd2bu7fzq9Dz9f3Pnnvmeme+cOWdmfnsOsI8hYAgYAobAfgjsMTwMAUPAEDAE9kfAiNF6hCFgCBgCIwSMGK1LGAKGgCFgxGh9wBAwBAoicJrUdbTIqwXrLFnVBVLZnyKfx1RqHmMMWlbWEDAEXAQgxSdELhL5o1NoDhW9XhZ5Q+SpUB1TiREWZpZAvux4tgjFQcv1PvvFtsfKGwJLIcBYeV7k7I5JUdsOOX4s8ngoOcYQI2R4wzA7fCv/PifynsiPSyG/UL24/FdM1P2v/P2Uhm26Rd59r8glIlGu/0JYhVaL3peKnCVyoMg+kY9Ebu1g0DAo7hK5VuSI0AZ1UE71vlh0OW7Qpxdc0e1nkctF3m2EVaxdKf9N6NgKIUZ1RSFGDHO/SLBL2gi0qdceI1/8MKMTRr6wgc5KiIcP7z5d/l0LMepE873o/LfICQM50pSWE40OHMgZskaXgxrYNuWVeGNvimh/GNfRE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/yzhI7+9U8jxg56lqlgCBgCfSFgxNiXPUwbQ8AQ6AABI8YOjGAqGAKGQF8IGDH2ZQ/TxhAwBDpAwIixAyOYCoaAIdAXAv8DTHJQRMY+X3gAAAAASUVORK5CYII=\" width=\"163\" height=\"18.5\" alt=\"6 = 5*1 + 3*1 + 2*(-1)\" style=\"width: 163px; height: 18.5px;\"\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: 110.5px 8px; transform-origin: 110.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Similarly, the number 20 could be \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: 20px 8px; transform-origin: 20px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 20px 8.5px; transform-origin: 20px 8.5px; \"\u003eppxxp\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: 64.5px 8px; transform-origin: 64.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in primary notation. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; 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 21px; text-align: left; transform-origin: 384px 21px; white-space-collapse: preserve; 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: 380px 8px; transform-origin: 380px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBecause integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a number can exist. \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/60783\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 60783\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: 35px 8px; transform-origin: 35px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e deals with \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: 21px 8px; transform-origin: 21px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eproper\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: 59px 8px; transform-origin: 59px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e primary notation.  \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-collapse: preserve; 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: 245px 8px; transform-origin: 245px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to convert integers expressed in primary notation to base 10. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = primary2dec(s)\r\n  y = base2dec(s,'primes')\r\nend","test_suite":"%%\r\nassert(isequal(primary2dec('ppm'),6))\r\n\r\n%%\r\nassert(isequal(primary2dec('ppxxp'),20))\r\n\r\n%%\r\nassert(isequal(primary2dec('x'),0))\r\n\r\n%%\r\nassert(isequal(primary2dec('pm'),1))\r\n\r\n%%\r\nassert(isequal(primary2dec('mp'),-1))\r\n\r\n%%\r\nassert(isequal(primary2dec('pxxpp'),16))\r\n\r\n%%\r\nassert(isequal(primary2dec('pxppxp'),27))\r\n\r\n%%\r\nassert(isequal(primary2dec('ppppp'),28))\r\n\r\n%%\r\nassert(isequal(primary2dec('mmmmpm'),-35))\r\n\r\n%%\r\nassert(isequal(primary2dec('mmxmmxmm'),-59))\r\n\r\n%%\r\nassert(isequal(primary2dec('pppppppm'),73))\r\n\r\n%%\r\nassert(isequal(primary2dec('mmmmxmmmmm'),-116))\r\n\r\n%%\r\nassert(isequal(primary2dec('ppppppppppppm'),234))\r\n\r\n%%\r\nassert(isequal(primary2dec('pppppxppppppppppppxp'),589))\r\n\r\n%%\r\nassert(isequal(primary2dec('mmmmmmmmxmmmmmmmmmmmmmmmmmmmxmmx'),-1753))\r\n\r\n%%\r\nassert(isequal(primary2dec('pppppppxpppppppppppppppppppppppppppppppppppppppxppppp'),5618))\r\n\r\n%%\r\nassert(isequal(primary2dec('mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmxmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmxmxm'),-74921))\r\n\r\n%%\r\nassert(isequal(primary2dec('ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppxpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppxpp'),514888))\r\n\r\n%%\r\nfiletext = fileread('primary2dec.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'assert') || contains(filetext,'str2num'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2025-01-06T21:00:45.000Z","deleted_by":null,"deleted_at":null,"solvers_count":10,"test_suite_updated_at":"2025-01-02T00:40:47.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2024-12-31T17:58:19.000Z","updated_at":"2026-03-16T10:13:49.000Z","published_at":"2024-12-31T17:58:24.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\u003eThe \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eprimary \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003esystem of expressing numbers has three digits: \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\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, \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\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and \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\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, which correspond to -1, 0, and 1. The places in a primary number correspond to the prime numbers. For example, the number 6 could be \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\u003eppm\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in primary notation because \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"6 = 5*1 + 3*1 + 2*(-1)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e6 = 5\\\\cdot 1 + 3\\\\cdot 1 + 2\\\\cdot(-1)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Similarly, the number 20 could be \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\u003eppxxp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in primary notation. \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\u003eBecause integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a number can exist. \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/60783\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 60783\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e deals with \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eproper\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e primary notation.  \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 convert integers expressed in primary notation to base 10. \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":49087,"title":"Energy Conversion 2","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 10.5px; transform-origin: 332px 10.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: 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=\"\"\u003eGiven an energy in Joule, convert it to MeV (Mega Electron Volt).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x/1e-18;\r\nend","test_suite":"%%\r\nx = 100;\r\ny_correct = 6.242e14;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 222;\r\ny_correct = 1.386e15;\r\nassert(abs(convert_stuff(x)-y_correct)\u003c1e12)\r\n","published":true,"deleted":false,"likes_count":12,"comments_count":4,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1273,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T22:12:08.000Z","updated_at":"2026-04-08T21:08:40.000Z","published_at":"2020-12-22T22:12:08.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\u003eGiven an energy in Joule, convert it to MeV (Mega Electron Volt).\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":1948,"title":"Convert this color - RGB Vector to Hex String","description":"Given a 3 element RGB vector corresponding to a color (given by the MATLAB color spec \u003chttp://www.mathworks.com/help/matlab/ref/colorspec.html\u003e), return the corresponding hex value string associated with it. This hex value string is often used when coding in HTML to specify a color. \r\n\r\nFor example, given the vector [0, 1, 1], you would return the string 00FFFF and given the vector [.5 .5 .2], you would return the string 7F7F33. We will assume that in this case once we multiply the vector by 255, we will round down to the nearest integer. If anyone thinks that we should not assume rounding down, feel free to comment :) \r\n\r\n","description_html":"\u003cp\u003eGiven a 3 element RGB vector corresponding to a color (given by the MATLAB color spec \u003ca href = \"http://www.mathworks.com/help/matlab/ref/colorspec.html\"\u003ehttp://www.mathworks.com/help/matlab/ref/colorspec.html\u003c/a\u003e), return the corresponding hex value string associated with it. This hex value string is often used when coding in HTML to specify a color.\u003c/p\u003e\u003cp\u003eFor example, given the vector [0, 1, 1], you would return the string 00FFFF and given the vector [.5 .5 .2], you would return the string 7F7F33. We will assume that in this case once we multiply the vector by 255, we will round down to the nearest integer. If anyone thinks that we should not assume rounding down, feel free to comment :)\u003c/p\u003e","function_template":"function hexString = rgb2hex(rgbColor)\r\n  hexString = rgbColor;\r\nend","test_suite":"%%\r\nx = [0,0,0.0001];\r\ny_correct = '000000';\r\nassert(isequal(rgb2hex(x),y_correct))\r\n\r\n%%\r\nx = [1,1,1];\r\ny_correct = 'FFFFFF';\r\nassert(isequal(rgb2hex(x),y_correct))\r\n\r\n%%\r\nx = [.5,.5,.2];\r\ny_correct = '7F7F33';\r\nassert(isequal(rgb2hex(x),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":3743,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":139,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-20T03:34:55.000Z","updated_at":"2026-02-04T11:54:49.000Z","published_at":"2013-10-20T03:34:55.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\u003eGiven a 3 element RGB vector corresponding to a color (given by the MATLAB color spec\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/matlab/ref/colorspec.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://www.mathworks.com/help/matlab/ref/colorspec.html\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e), return the corresponding hex value string associated with it. This hex value string is often used when coding in HTML to specify a color.\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\u003eFor example, given the vector [0, 1, 1], you would return the string 00FFFF and given the vector [.5 .5 .2], you would return the string 7F7F33. We will assume that in this case once we multiply the vector by 255, we will round down to the nearest integer. If anyone thinks that we should not assume rounding down, feel free to comment :)\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":49072,"title":"Area Conversion 2","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 10.5px; transform-origin: 332px 10.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: 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=\"\"\u003eGiven an area in hectares, convert it to acres.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x*713*pi;\r\nend","test_suite":"%%\r\nx = 121;\r\ny_correct = 299.0031;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 333;\r\ny_correct = 822.8763;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 1.2;\r\ny_correct = 2.9653;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":2,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":833,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:57:51.000Z","updated_at":"2026-04-08T20:56:49.000Z","published_at":"2020-12-22T21:57: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\u003eGiven an area in hectares, convert it to acres.\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":49057,"title":"Mass Conversion 1","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.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 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: 246.5px 8px; transform-origin: 246.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a mass in kg, convert it into lbs. Use a conversion factor of 2.205 lbs/kg.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x+x+x+x;\r\nend","test_suite":"%%\r\nx = 10;\r\ny_correct = 22.05;\r\nassert(abs(convert_stuff(x) - y_correct) \u003c 1e-4)\r\n%%\r\nx = 11;\r\ny_correct = 24.255;\r\nassert(abs(convert_stuff(x) - y_correct) \u003c 1e-4)\r\n%%\r\nx = -3;\r\ny_correct = 'Cannot have a negative mass';\r\nassert(isequal(convert_stuff(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":12,"comments_count":5,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1575,"test_suite_updated_at":"2021-01-11T11:36:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:45:53.000Z","updated_at":"2026-04-08T17:01:15.000Z","published_at":"2020-12-22T21:45:53.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\u003eGiven a mass in kg, convert it into lbs. Use a conversion factor of 2.205 lbs/kg.\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":49062,"title":"Mass Conversion 2","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.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 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: 246.5px 8px; transform-origin: 246.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a mass in lbs, convert it into kg. Use a conversion factor of 2.205 lbs/kg.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x/x+x*x;\r\nend","test_suite":"%%\r\nx = 22.05;\r\ny_correct = 10;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 50;\r\ny_correct = 22.6757;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 93;\r\ny_correct = 42.1769;\r\nassert(isequal(convert_stuff(x),y_correct))","published":true,"deleted":false,"likes_count":5,"comments_count":10,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":983,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:48:46.000Z","updated_at":"2026-04-08T20:45:28.000Z","published_at":"2020-12-22T21:48: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\u003eGiven a mass in lbs, convert it into kg. Use a conversion factor of 2.205 lbs/kg.\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":8046,"title":"Gold/Silver Standard","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard Gold Standard\u003e problem, suppose that you have data for silver rather than gold to make an assessment regarding historical currency values. Historical data for the silver-to-gold ratio is also available from \u003chttp://measuringworth.com/gold/ Measuring Worth\u003e.\r\n\r\nFor this problem, you will be provided with a historical year (HY) and a historical value (HV) in dollars. The function template includes data from the previously mentioned site for the value (in dollars) of an ounce of gold (GV), in addition to the silver-to-gold ratio, from 1791 to 2014. Write a function to determine the current value (CV) in dollars assuming that the gold standard must be converted to the silver standard to accurately convert between years. Round the result to two decimal places. If HY is outside of the historical data range, return NaN.\r\n\r\nAs an example, with HY = 2000 and HV = 1000:\r\n\r\n* GV(HY=2000) = $280.10\r\n* N = 1000/280.10 = 3.57 (ounces of gold)\r\n* SR(HY=2000) = 55.96\r\n* NS = 55.96*3.57 = 199.79 (ounces of silver)\r\n* NG = 199.79/66.38 = 3.01 (current ounces of gold) [SR(2014) = 66.38]\r\n* CV = 3.01*1270 (current $/ounce of gold) = $3822.36.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard\"\u003eGold Standard\u003c/a\u003e problem, suppose that you have data for silver rather than gold to make an assessment regarding historical currency values. Historical data for the silver-to-gold ratio is also available from \u003ca href = \"http://measuringworth.com/gold/\"\u003eMeasuring Worth\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eFor this problem, you will be provided with a historical year (HY) and a historical value (HV) in dollars. The function template includes data from the previously mentioned site for the value (in dollars) of an ounce of gold (GV), in addition to the silver-to-gold ratio, from 1791 to 2014. Write a function to determine the current value (CV) in dollars assuming that the gold standard must be converted to the silver standard to accurately convert between years. Round the result to two decimal places. If HY is outside of the historical data range, return NaN.\u003c/p\u003e\u003cp\u003eAs an example, with HY = 2000 and HV = 1000:\u003c/p\u003e\u003cul\u003e\u003cli\u003eGV(HY=2000) = $280.10\u003c/li\u003e\u003cli\u003eN = 1000/280.10 = 3.57 (ounces of gold)\u003c/li\u003e\u003cli\u003eSR(HY=2000) = 55.96\u003c/li\u003e\u003cli\u003eNS = 55.96*3.57 = 199.79 (ounces of silver)\u003c/li\u003e\u003cli\u003eNG = 199.79/66.38 = 3.01 (current ounces of gold) [SR(2014) = 66.38]\u003c/li\u003e\u003cli\u003eCV = 3.01*1270 (current $/ounce of gold) = $3822.36.\u003c/li\u003e\u003c/ul\u003e","function_template":"function [CV] = gold_silver_standard(HY,HV)\r\n\r\nY = 1791:2014;\r\nGV = [19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 20.1, 21.64, 20.95, 19.46, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.94, 20.69, 20.69, 21.64, 20.86, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.7, 20.67, 20.67, 20.67, 20.67, 23.42, 30.02, 42.03, 32.52, 29.13, 28.57, 28.88, 27.49, 23.75, 23.09, 23.24, 23.52, 22.99, 23.75, 23.05, 21.66, 20.84, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 24.44, 34.94, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 39.26, 41.51, 36.41, 41.25, 58.6, 97.81, 159.74, 161.49, 125.32, 148.31, 193.55, 307.5, 612.56, 459.64, 375.91, 424, 360.66, 317.66, 368.24, 447.95, 438.31, 382.58, 384.93, 363.29, 344.97, 360.91, 385.42, 385.5, 389.09, 332.39, 295.24, 279.91, 280.1, 272.22, 311.33, 364.8, 410.52, 446, 606, 699, 874, 975, 1227, 1572, 1700, 1415, 1270];\r\nSR = [15.05, 15.17, 15, 15.37, 15.55, 15.65, 15.41, 15.59, 15.74, 15.68, 15.46, 15.26, 15.41, 15.41, 15.79, 15.52, 15.43, 16.08, 15.96, 15.77, 15.53, 16.11, 16.25, 15.04, 15.26, 15.28, 15.11, 15.35, 15.33, 15.62, 15.95, 15.8, 15.84, 15.82, 15.7, 15.76, 15.74, 15.78, 15.78, 15.82, 15.72, 15.73, 15.93, 15.73, 15.8, 15.72, 15.83, 15.85, 15.62, 15.62, 15.7, 15.87, 15.93, 15.85, 15.92, 15.9, 15.8, 15.85, 15.78, 15.7, 15.46, 15.59, 15.33, 15.33, 15.38, 15.38, 15.27, 15.38, 15.19, 15.29, 15.5, 15.35, 15.37, 15.37, 15.44, 15.43, 15.57, 15.59, 15.6, 15.57, 15.57, 15.63, 15.93, 16.16, 16.64, 17.75, 17.2, 17.92, 18.39, 18.05, 18.25, 18.2, 18.64, 18.61, 19.41, 20.78, 21.1, 22, 22.1, 19.75, 20.92, 23.72, 26.49, 32.56, 31.6, 30.59, 34.2, 35.03, 34.36, 33.33, 34.68, 39.15, 38.1, 35.7, 33.87, 30.54, 31.24, 38.64, 39.74, 38.22, 38.33, 33.62, 34.19, 37.37, 40.48, 30.78, 24.61, 21, 18.44, 20.28, 32.76, 30.43, 31.69, 30.8, 29.78, 33.11, 36.47, 35.34, 38.78, 53.74, 71.25, 73.29, 69.83, 72.36, 54.19, 77.09, 77.44, 80.39, 88.84, 99.76, 99.73, 90.57, 77.67, 77.67, 67.4, 43.67, 48.73, 47.07, 48.61, 47.14, 39.12, 41.16, 41.04, 41.01, 39.24, 38.5, 38.5, 39.27, 38.34, 38.27, 37.82, 32.22, 27.34, 27.04, 27.04, 27.04, 22.56, 18.29, 23.16, 20.54, 26.66, 34.75, 38.21, 33.9, 36.51, 28.76, 32.05, 35.8, 27.69, 29.66, 43.65, 47.24, 37.03, 44.26, 51.68, 67.25, 63.84, 66.95, 69.49, 79.78, 89.83, 87.47, 83.85, 72.79, 74.78, 74.89, 67.91, 53.24, 53.26, 55.96, 61.95, 67.32, 74.22, 61.3, 60.7, 52.2, 51.91, 58.17, 66.27, 60.64, 44.75, 53.58, 59.31, 66.38];\r\n\r\nCV = 1;\r\n\r\nend\r\n","test_suite":"%% current check\r\nHY = 2014; HV = 1270; CV_corr = 1270;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%% out-of-range check 1\r\nHY = 500; HV = 50; CV_corr = NaN;\r\nassert(isnan(gold_silver_standard(HY,HV)))\r\n\r\n%% out-of-range check 2\r\nHY = 2500; HV = 5000; CV_corr = NaN;\r\nassert(isnan(gold_silver_standard(HY,HV)))\r\n\r\n%%\r\nHY = 2010; HV = 1000; CV_corr = 945.54;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 2005; HV = 1000; CV_corr = 2603.88;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 2000; HV = 1000; CV_corr = 3822.36;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1995; HV = 1000; CV_corr = 3711.31;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1990; HV = 1000; CV_corr = 3965.32;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1950; HV = 1000; CV_corr = 25768.43;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1900; HV = 1000; CV_corr = 30850.44;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1850; HV = 1000; CV_corr = 14532.01;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1800; HV = 1000; CV_corr = 15471.58;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tHY = 2000; HV = 1000; CV_corr = 3822.36;\r\n\tcase 2\r\n\t\tHY = 1995; HV = 1000; CV_corr = 3711.31;\r\n\tcase 3\r\n\t\tHY = 2005; HV = 1000; CV_corr = 2603.88;\r\n\tcase 4\r\n\t\tHY = 1800; HV = 1000; CV_corr = 15471.58;\r\nend\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tHY = 1995; HV = 1000; CV_corr = 3711.31;\r\n\tcase 2\r\n\t\tHY = 1990; HV = 1000; CV_corr = 3965.32;\r\n\tcase 3\r\n\t\tHY = 2010; HV = 1000; CV_corr = 945.54;\r\n\tcase 4\r\n\t\tHY = 1900; HV = 1000; CV_corr = 30850.44;\r\nend\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tHY = 1990; HV = 1000; CV_corr = 3965.32;\r\n\tcase 2\r\n\t\tHY = 1950; HV = 1000; CV_corr = 25768.43;\r\n\tcase 3\r\n\t\tHY = 1900; HV = 1000; CV_corr = 30850.44;\r\n\tcase 4\r\n\t\tHY = 2000; HV = 1000; CV_corr = 3822.36;\r\nend\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":56,"test_suite_updated_at":"2015-03-30T16:51:28.000Z","rescore_all_solutions":false,"group_id":30,"created_at":"2015-03-30T16:22:04.000Z","updated_at":"2026-03-27T06:19:08.000Z","published_at":"2015-03-30T16:22:04.000Z","restored_at":"2017-07-28T15:24:51.000Z","restored_by":null,"spam":false,"simulink":false,"admin_reviewed":true,"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\u003ePursuant to the\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/8045-gold-standard\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGold Standard\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e problem, suppose that you have data for silver rather than gold to make an assessment regarding historical currency values. Historical data for the silver-to-gold ratio is also available from\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://measuringworth.com/gold/\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMeasuring Worth\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\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor this problem, you will be provided with a historical year (HY) and a historical value (HV) in dollars. The function template includes data from the previously mentioned site for the value (in dollars) of an ounce of gold (GV), in addition to the silver-to-gold ratio, from 1791 to 2014. Write a function to determine the current value (CV) in dollars assuming that the gold standard must be converted to the silver standard to accurately convert between years. Round the result to two decimal places. If HY is outside of the historical data range, return NaN.\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\u003eAs an example, with HY = 2000 and HV = 1000:\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\u003eGV(HY=2000) = $280.10\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\u003eN = 1000/280.10 = 3.57 (ounces of gold)\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\u003eSR(HY=2000) = 55.96\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\u003eNS = 55.96*3.57 = 199.79 (ounces of silver)\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\u003eNG = 199.79/66.38 = 3.01 (current ounces of gold) [SR(2014) = 66.38]\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\u003eCV = 3.01*1270 (current $/ounce of gold) = $3822.36.\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":2283,"title":"Convert a number to its Roman representation","description":"Convert a given number to its Roman representation.\r\n\r\nFor example, if the number is 98, it should display 'XCVIII'","description_html":"\u003cp\u003eConvert a given number to its Roman representation.\u003c/p\u003e\u003cp\u003eFor example, if the number is 98, it should display 'XCVIII'\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 'I';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 98;\r\ny_correct = 'XCVIII';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 501;\r\ny_correct = 'DI';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 867;\r\ny_correct = 'DCCCLXVII';\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":22816,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":35,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-04-14T05:55:54.000Z","updated_at":"2025-12-07T23:09:08.000Z","published_at":"2014-04-14T05:55:57.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 a given number to its Roman representation.\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\u003eFor example, if the number is 98, it should display 'XCVIII'\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":42849,"title":"RGB to CMYK","description":"Convert an RGB code to the corresponding CMYK code for printing.\r\n\r\n\r\nThe RGB input is a [1×3] double array between 0 and 1.\r\n\r\nCMYK must be a [1×4] double array between 0 and 1.","description_html":"\u003cp\u003eConvert an RGB code to the corresponding CMYK code for printing.\u003c/p\u003e\u003cp\u003eThe RGB input is a [1×3] double array between 0 and 1.\u003c/p\u003e\u003cp\u003eCMYK must be a [1×4] double array between 0 and 1.\u003c/p\u003e","function_template":"function CMYK = rgb2cmyk(RGB)\r\n  CMYK = RGB;\r\nend","test_suite":"%%\r\nRGB   = [0,0,0];\r\nCMYK  = [0,0,0,1];\r\nassert(isequal(rgb2cmyk(RGB),CMYK))\r\n%%\r\nRGB   = [1,1,1];\r\nCMYK  = [0,0,0,0];\r\nassert(isequal(rgb2cmyk(RGB),CMYK))\r\n%%\r\nRGB   = [1,0,0];\r\nCMYK  = [0,1,1,0];\r\nassert(isequal(rgb2cmyk(RGB),CMYK))\r\n%%\r\nRGB   = [1,1,0];\r\nCMYK  = [0,0,1,0];\r\nassert(isequal(rgb2cmyk(RGB),CMYK))\r\n%%\r\nRGB   = [150,25,0]/255;\r\nCMYK  = [0,5/6,1,7/17];\r\nerror = abs(rgb2cmyk(RGB)-CMYK);\r\nassert(all(error\u003c1e-4))","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":12767,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":133,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-05-05T15:25:57.000Z","updated_at":"2026-02-03T09:25:44.000Z","published_at":"2016-05-05T15:26:16.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 an RGB code to the corresponding CMYK code for printing.\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\u003eThe RGB input is a [1×3] double array between 0 and 1.\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\u003eCMYK must be a [1×4] double array between 0 and 1.\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":49067,"title":"Area Conversion 1","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 10.5px; transform-origin: 332px 10.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: 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=\"\"\u003eGiven an area in ft^2, convert it to m^2.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x+area*2;\r\nend","test_suite":"%%\r\nx = 11;\r\ny_correct = 1.0219;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 336;\r\ny_correct = 31.2144;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 121;\r\ny_correct = 11.2409;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 12.5;\r\ny_correct = 1.1613;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":11,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1026,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:53:28.000Z","updated_at":"2026-04-08T20:52:09.000Z","published_at":"2020-12-22T21:53:28.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\u003eGiven an area in ft^2, convert it to m^2.\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":8047,"title":"Weighted Gold/Silver Standard","description":"Building off of the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard Gold Standard\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8046-gold-silver-standard Gold/Silver Standard\u003e problems, let's make a weighted currency convertor. The same data for gold value and silver-to-gold ratio will be provided in the function template.\r\n\r\nFor this problem, based on a historical year (HY) and a historical value (HV) in dollars, calculate the current value using the gold (CVG) and silver (CVS) references; see the referenced problems for details and examples of those individual problems. In this case, you will be provided a weighting that will range from 0 to 1, where 0 indicates complete weighting by gold and 1 indicates complete weighting by silver. Remember to round the result to two decimal places. If HY is outside of the historical data range, return NaN.\r\n\r\nAs an example, with HY = 2000, HV = 1000, and wt = 0.4:\r\n\r\n* CVG = $4534.09 (gold standard)\r\n* CVS = $3822.36 (silver standard)\r\n* CV = (1-0.4)*4534.09 + 0.4*3822.36 = $4249.40.","description_html":"\u003cp\u003eBuilding off of the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard\"\u003eGold Standard\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8046-gold-silver-standard\"\u003eGold/Silver Standard\u003c/a\u003e problems, let's make a weighted currency convertor. The same data for gold value and silver-to-gold ratio will be provided in the function template.\u003c/p\u003e\u003cp\u003eFor this problem, based on a historical year (HY) and a historical value (HV) in dollars, calculate the current value using the gold (CVG) and silver (CVS) references; see the referenced problems for details and examples of those individual problems. In this case, you will be provided a weighting that will range from 0 to 1, where 0 indicates complete weighting by gold and 1 indicates complete weighting by silver. Remember to round the result to two decimal places. If HY is outside of the historical data range, return NaN.\u003c/p\u003e\u003cp\u003eAs an example, with HY = 2000, HV = 1000, and wt = 0.4:\u003c/p\u003e\u003cul\u003e\u003cli\u003eCVG = $4534.09 (gold standard)\u003c/li\u003e\u003cli\u003eCVS = $3822.36 (silver standard)\u003c/li\u003e\u003cli\u003eCV = (1-0.4)*4534.09 + 0.4*3822.36 = $4249.40.\u003c/li\u003e\u003c/ul\u003e","function_template":"function [CV] = gold_silver_weighted_standard(HY,HV,wt)\r\n\r\nY = 1791:2014;\r\nGV = [19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 20.1, 21.64, 20.95, 19.46, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.94, 20.69, 20.69, 21.64, 20.86, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.7, 20.67, 20.67, 20.67, 20.67, 23.42, 30.02, 42.03, 32.52, 29.13, 28.57, 28.88, 27.49, 23.75, 23.09, 23.24, 23.52, 22.99, 23.75, 23.05, 21.66, 20.84, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 24.44, 34.94, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 39.26, 41.51, 36.41, 41.25, 58.6, 97.81, 159.74, 161.49, 125.32, 148.31, 193.55, 307.5, 612.56, 459.64, 375.91, 424, 360.66, 317.66, 368.24, 447.95, 438.31, 382.58, 384.93, 363.29, 344.97, 360.91, 385.42, 385.5, 389.09, 332.39, 295.24, 279.91, 280.1, 272.22, 311.33, 364.8, 410.52, 446, 606, 699, 874, 975, 1227, 1572, 1700, 1415, 1270];\r\nSR = [15.05, 15.17, 15, 15.37, 15.55, 15.65, 15.41, 15.59, 15.74, 15.68, 15.46, 15.26, 15.41, 15.41, 15.79, 15.52, 15.43, 16.08, 15.96, 15.77, 15.53, 16.11, 16.25, 15.04, 15.26, 15.28, 15.11, 15.35, 15.33, 15.62, 15.95, 15.8, 15.84, 15.82, 15.7, 15.76, 15.74, 15.78, 15.78, 15.82, 15.72, 15.73, 15.93, 15.73, 15.8, 15.72, 15.83, 15.85, 15.62, 15.62, 15.7, 15.87, 15.93, 15.85, 15.92, 15.9, 15.8, 15.85, 15.78, 15.7, 15.46, 15.59, 15.33, 15.33, 15.38, 15.38, 15.27, 15.38, 15.19, 15.29, 15.5, 15.35, 15.37, 15.37, 15.44, 15.43, 15.57, 15.59, 15.6, 15.57, 15.57, 15.63, 15.93, 16.16, 16.64, 17.75, 17.2, 17.92, 18.39, 18.05, 18.25, 18.2, 18.64, 18.61, 19.41, 20.78, 21.1, 22, 22.1, 19.75, 20.92, 23.72, 26.49, 32.56, 31.6, 30.59, 34.2, 35.03, 34.36, 33.33, 34.68, 39.15, 38.1, 35.7, 33.87, 30.54, 31.24, 38.64, 39.74, 38.22, 38.33, 33.62, 34.19, 37.37, 40.48, 30.78, 24.61, 21, 18.44, 20.28, 32.76, 30.43, 31.69, 30.8, 29.78, 33.11, 36.47, 35.34, 38.78, 53.74, 71.25, 73.29, 69.83, 72.36, 54.19, 77.09, 77.44, 80.39, 88.84, 99.76, 99.73, 90.57, 77.67, 77.67, 67.4, 43.67, 48.73, 47.07, 48.61, 47.14, 39.12, 41.16, 41.04, 41.01, 39.24, 38.5, 38.5, 39.27, 38.34, 38.27, 37.82, 32.22, 27.34, 27.04, 27.04, 27.04, 22.56, 18.29, 23.16, 20.54, 26.66, 34.75, 38.21, 33.9, 36.51, 28.76, 32.05, 35.8, 27.69, 29.66, 43.65, 47.24, 37.03, 44.26, 51.68, 67.25, 63.84, 66.95, 69.49, 79.78, 89.83, 87.47, 83.85, 72.79, 74.78, 74.89, 67.91, 53.24, 53.26, 55.96, 61.95, 67.32, 74.22, 61.3, 60.7, 52.2, 51.91, 58.17, 66.27, 60.64, 44.75, 53.58, 59.31, 66.38];\r\n\r\nCV = 1;\r\n\r\nend\r\n","test_suite":"%% current check\r\nHY = 2014; HV = 1270; wt = 0.5; CV_corr = 1270;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%% out-of-range check 1\r\nHY = 500; HV = 50; wt = 0.5; CV_corr = NaN;\r\nassert(isnan(gold_silver_weighted_standard(HY,HV,wt)))\r\n\r\n%% out-of-range check 2\r\nHY = 2500; HV = 5000; wt = 0.5; CV_corr = NaN;\r\nassert(isnan(gold_silver_weighted_standard(HY,HV,wt)))\r\n\r\n%%\r\nHY = 2010; HV = 1000; wt = 0.5; CV_corr = 990.29;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 2005; HV = 1000; wt = 0.5; CV_corr = 2725.7;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 2000; HV = 1000; wt = 0.5; CV_corr = 4178.23;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1995; HV = 1000; wt = 0.5; CV_corr = 3502.87;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1990; HV = 1000; wt = 0.5; CV_corr = 3632.31;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1950; HV = 1000; wt = 0.5; CV_corr = 31027.07;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1900; HV = 1000; wt = 0.5; CV_corr = 46146.07;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1850; HV = 1000; wt = 0.5; CV_corr = 37986.86;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1800; HV = 1000; wt = 0.5; CV_corr = 40484.63;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 2000; HV = 1000;\r\nwt = randi(10)/10;\r\nswitch (wt*10)\r\n\tcase 0\r\n\t\tCV_corr = 4534.09;\r\n\tcase 1\r\n\t\tCV_corr = 4462.92;\r\n\tcase 2\r\n\t\tCV_corr = 4391.75;\r\n\tcase 3\r\n\t\tCV_corr = 4320.57;\r\n\tcase 4\r\n\t\tCV_corr = 4249.4;\r\n\tcase 5\r\n\t\tCV_corr = 4178.23;\r\n\tcase 6\r\n\t\tCV_corr = 4107.05;\r\n\tcase 7\r\n\t\tCV_corr = 4035.88;\r\n\tcase 8\r\n\t\tCV_corr = 3964.7;\r\n\tcase 9\r\n\t\tCV_corr = 3893.53;\r\n\tcase 10\r\n\t\tCV_corr = 3822.36;\r\nend\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1800; HV = 1000;\r\nwt = randi(10)/10;\r\nswitch (wt*10)\r\n\tcase 0\r\n\t\tCV_corr = 65497.68;\r\n\tcase 1\r\n\t\tCV_corr = 60495.07;\r\n\tcase 2\r\n\t\tCV_corr = 55492.46;\r\n\tcase 3\r\n\t\tCV_corr = 50489.85;\r\n\tcase 4\r\n\t\tCV_corr = 45487.24;\r\n\tcase 5\r\n\t\tCV_corr = 40484.63;\r\n\tcase 6\r\n\t\tCV_corr = 35482.02;\r\n\tcase 7\r\n\t\tCV_corr = 30479.41;\r\n\tcase 8\r\n\t\tCV_corr = 25476.8;\r\n\tcase 9\r\n\t\tCV_corr = 20474.19;\r\n\tcase 10\r\n\t\tCV_corr = 15471.58;\r\nend\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":50,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":30,"created_at":"2015-03-30T16:47:31.000Z","updated_at":"2026-03-27T06:22:48.000Z","published_at":"2015-03-30T16:47:31.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\u003eBuilding off of the\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/8045-gold-standard\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGold Standard\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e 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=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8046-gold-silver-standard\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGold/Silver Standard\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e problems, let's make a weighted currency convertor. The same data for gold value and silver-to-gold ratio will be provided in the function template.\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\u003eFor this problem, based on a historical year (HY) and a historical value (HV) in dollars, calculate the current value using the gold (CVG) and silver (CVS) references; see the referenced problems for details and examples of those individual problems. In this case, you will be provided a weighting that will range from 0 to 1, where 0 indicates complete weighting by gold and 1 indicates complete weighting by silver. Remember to round the result to two decimal places. If HY is outside of the historical data range, return NaN.\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\u003eAs an example, with HY = 2000, HV = 1000, and wt = 0.4:\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\u003eCVG = $4534.09 (gold standard)\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\u003eCVS = $3822.36 (silver standard)\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\u003eCV = (1-0.4)*4534.09 + 0.4*3822.36 = $4249.40.\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":49835,"title":"Decimal to Binary conversion for Large Integers","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: 436.9px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 218.45px; transform-origin: 407px 218.45px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 41.6px; 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=\"\"\u003eDecimal integer, a base-10 number we normally use without fractional component, can be represented as \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Binary_number\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ebinary\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, a base-2 number composed either 0 or 1. The procedure to convert a decimal integer X to its binary equivalent is as follows:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003col style=\"block-size: 60px; font-family: Helvetica, Arial, sans-serif; list-style-type: decimal; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 30px; transform-origin: 391px 30px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eDivide X by 2. The remainder (either 0 or 1) is the first binary value.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eDivide the quotient of previous step by 2. The remainder is the next binary value.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eRepeat the process until the quotient cannot be divided anymore and so last binary is found.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e\u003cdiv style=\"block-size: 22.1px; 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 11.05px; text-align: left; transform-origin: 384px 11.05px; 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=\"\"\u003eAs example, \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARsAAAAnCAYAAAA/4uxDAAAJqklEQVR4Xu2dd8gtRxmHn9gL9o5dDFFsiKCiotjRP+zGLooVe8PeEiti19i7JhoTOyoqIvbeUBFRULF37FgTnss7l7mb3XNmd+493zfnzEBIyE55z292fvvW+Y6it45AR6AjsAEEjtrAGn2JjkBHoCNAJ5v+EnQEOgIbQaCTzUZg7ot0BDoCnWz6O9AR6AhsBIFONhuBuS/SEegI7BXZuO51gd8DP+zb0BHoCGw/AqvI5kzAdYD7ATcDLgt8GjgVeDvw5zXwXBR4PXCbiX5vAR4G/D2enx14AfCIQtgfA7yksO82d7sM8HDgG8A7C36oON8auC3wM+AScCBQ8Dbgs8D/V8xRMzafdpMyt7hu6zKPvkJTZHNO4LHA44EfAb8LsjkmZvkw8GDg5ytezDsA71nx/I7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ya4dS2ZUOaIlOTjpPmmyCYRirIPo1qriGjdF2fd71j1vJZsrH7/SCwgvuuq7FVtrXMyomfKQlJ/NYtNuPx6YGMd27DVjM3n2qTMLa7busxGpJKVkK4pOfCbxsjGUNajgGPDEWw/C/e8FU+N5Ys5Ww3eyEvH2BtHjZSPrfyWcN4f/73q2sk0XW5CrXJojh3kJWSTKozHtJ4aMjkSY9UQdcKJi05c98smQehrsbbJSvupqnivAHGs/1j2oUZqyrtj1WYPCVcOfsDSsXslc4vrtihzek0sJ1Ix+M/IBWyLQ99H4hAdrjk3YUYdLln7PB2BbULACgE/Yp7BM5QxLXEQ73dwpsgmRdDUsrbFQbzf96LLtzsIWEepKe8Fd8OrZybNqNbhmRv6lnCfEc7rfgNg67vf5d8LBPTJevuj+TaTgZ9d0mz8rYbrzQ3I82m8jjQVk47dzbsXm9fX7Ai0goCRSoM+5tt8NxNa/425a+bjHdB0to1skpaipuLFXVPlCv71BvsYlbG84fnxJ1F0kPbWEegIlCFgwMC/9eY1FwaC8nbFyPg3In2gnnGbyMakNKM0+mPMf3lT5AMZzs3vVTGxUNtS1U/GdZzh4C8XXs5etg29V0dguxEwamYejWQy1s7wt922iWy2e2v7r+sINI5AJ5vGN7CL3xFoBYFONq3sVJezI9A4Ap1sGt/ALn5HoBUEOtm0slNdzo5A4wh0sml8A7v4HYFWEDgdiAl0ZCqegPsAAAAASUVORK5CYII=\" width=\"141.5\" height=\"19.5\" style=\"width: 141.5px; height: 19.5px;\"\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 through process below:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 223.6px; 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 111.8px; text-align: left; transform-origin: 384px 111.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=\"\"\u003e        \u003c/span\u003e\u003c/span\u003e\u003cimg class=\"imageNode\" width=\"60\" height=\"218\" style=\"vertical-align: baseline;width: 60px;height: 218px\" src=\"https://upload.wikimedia.org/wikipedia/commons/d/d0/Decimal_to_Binary_Conversion.gif\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 41.6px; 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=\"\"\u003eGiven a decimal string input x, build a function dectobin(x) that returns its binary equivalent in character array. Unlike built-in dec2bin function, your function should also work for large integers up to thousands number of digits.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = dectobin(x)\r\n  y = x;\r\nend","test_suite":"clear\r\n%%\r\nbannedWords = {'regexp','regexpi','import','java'};\r\nassessFunctionAbsence(bannedWords,'Filename','dectobin.m')\r\n\r\n%%\r\nx = '0';\r\ny_correct = x;\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\nx = '1';\r\ny_correct = x;\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\nx = '13';\r\ny_correct = dec2bin(str2num(x));\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\nx = '1234';\r\ny_correct = dec2bin(str2num(x));\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\nx = '123456789';\r\ny_correct = dec2bin(str2num(x));\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\nx = num2str(randi([1e6 1e9])); % 7-10 digits\r\ny_correct = dec2bin(str2num(x));\r\nassert(isequal(dectobin(x),y_correct))\r\n \r\n%%\r\nx = num2str(int64(randi([1e14 1e15]))); % 15-16 digits\r\ny_correct = dec2bin(str2num(x));\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\n% 100 digits\r\nx = '9935889422099775700620749019825066687005320193436482650621467845674334663581207733950858713953594810';\r\ny_correct = '100100010101110101001011011110111011001010010010000001101010001111010001111000110111110100011000000010001001010111101101111101000101110000110110100100001101001010010001010000010011111111010100111111100110010011111001110111001111011111000010011101111100000000100000001011011000001010111001110001010101001101110011111011110110110111010';\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\n% 1,000 digits\r\nx = '3059201154261253530451690354977606310924322607284223918856338124374709270871880662494169428937121052075859797206813475095556104269276596500978875324047465920883111580522711413182514848655486194576723389296141674672149809829265420167820519225209898307641365760914568721866463844355172261421834003336488535238809007328873935253700111210006241805977393874531741494641320187019834745948717074377488851592337628009671305943507313220241345532153678625541382153876303729081245594666363375641541440039672508266173273547591929050186861649876277730738299377510850280883881669370053397327830542446255453962902873897458955875563317360197974644289445704776742967853660702740237720951325610419441880361333911947025395121778148262639261460523590232675016389707381618111484504793129877986986813532838182033892534760974140550358778239119177192242757139854881677013489678325929427533280319023842380171528893573940130880205407716783800858180602225696643483888830206964236483084265907918866516345819848257322544972900223';\r\ny_correct = '100101010000010000001101010010100110001010110110111010110011000100110001100101100011010101101110000011101111100011011101110100000001001001011110000111111011111011111000010010000010011011110011111010101100001111001111111100010001100110011101011011100101001001011100111000011000111100110110110100001000110101011010001110110111010010001111111101100110111110110100101010000110100010110101110011100111100011100000101001001011110010010000110011001011111101100001001110010001111011011100001101100111000011001000101100000110011101000010001011110101110111010001110111011111000010100000010010000001001010001010110101010111100101100111010110011101001000111001001101100110010111011001010011010100011100010100111010110111011111111101010111011000000010111010110100001010001000110010011011000110111011110011101010100101101100000101010000101001000000000010010110000110100111111000111110001011001111110010001011011100011110011001110001101110010010101100101110100110100101000110001010110011000010011110101111110100010100011001101010101101110100001010000100001011010110110000111011001000001101111110011111000100001100000011101010011011000010111110100111100111010101001001001111001011000100001110101110001001110110010010101001000111001010100101110000110111001110001110111100110110101011010000001110110011010011011101100100000101111100001010010100000000001111101001011111110001100001001110101101111101101110111100001000001111101111111100100010111000011111001110011101001001110111001001111011000110000101100101000101100001001101000110000011010001111001110000100001011110111011011111111110000000011110101111101001100101010101111111011010001100100100001110000010110110100101100111111100100011101000111010100001001111110010101101100101010101011100000101101001110000010001011010110101100000011010100111010001111100100001001101000010011100110000010111111010000110010100000110101010000000001010000011011011101001010111010100111100011100011101101111010010110111001000111001001010000111100001110111110110000000001100011100010111110100010000110111110111110000001010000011010001001000011100011011010110010000010101011100100010110101000111110111101111110101011001101001000011110010101011000000000010110010000110010011100101000101101001111011010010101100110011011110101111111001010000100011111000100000010000101110100110100000111111011111011111011010110100000100100010011001010111101110010011011001010000111011111011100101111000100000100101010110000110000000001000100110100000111101111000011111110010101011101101100110111001011110101110000010000101110010100101000101111100110011111111111001001011101010111001001100110010101011101000101011110100100001111001111101110101100011110100001010110101110100011110001101001101011010110011101101011111101001010010110101001011001011001101110010100001001100101110001101100110010010010011111010011111110110000100010101011101001110000010010010110001100011100100011010011011010111010110100110011101000000101010101100110101000111111010000110011010000001111001111101000010111010111101100100111100001010001010110010100001010010010110110100101000001001101010101101100111011111101000110100000100110111010100111101011100111001111110001101111001111010101111111100101000111010101101011110010010001110001111111011000001001001000101010001000111101001011011001010010011011001010110110000011000001100110010011111011110010011101111111';\r\nassert(isequal(dectobin(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":392030,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":"2021-01-17T04:22:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2021-01-16T07:49:57.000Z","updated_at":"2025-11-19T01:41:17.000Z","published_at":"2021-01-16T08:14:40.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\u003eDecimal integer, a base-10 number we normally use without fractional component, can be represented as \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Binary_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ebinary\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, a base-2 number composed either 0 or 1. The procedure to convert a decimal integer X to its binary equivalent is as follows:\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=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivide X by 2. The remainder (either 0 or 1) is the first binary value.\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=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivide the quotient of previous step by 2. The remainder is the next binary value.\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=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRepeat the process until the quotient cannot be divided anymore and so last binary is found.\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\u003eAs example, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e357_{10} \\\\equiv 10010101101_2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e through process 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=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e        \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"218\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"60\\\"/\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\u003eGiven a decimal string input x, build a function dectobin(x) that returns its binary equivalent in character array. Unlike built-in dec2bin function, your function should also work for large integers up to thousands number of digits.\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.gif\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.gif\",\"contentType\":\"image/gif\",\"content\":\"https://upload.wikimedia.org/wikipedia/commons/d/d0/Decimal_to_Binary_Conversion.gif\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2413,"title":"Temperature Conversion Utility","description":"There are a few problems on Cody regarding temperature conversion (C to K, C to F, F to C), but none include Rankine. Furthermore, they each involve simple one-liner solutions. For this problem, you are to write a utility function that takes a given temperature and two capital letters designating which temperature scale is being converted to which. For example, T_convertor(100,'C','F') requires 100 degrees Celsius be converted to Fahrenheit.\r\n\r\nThe test suite includes all 16 possible combinations: C to F, C to R, C to C, C to K, K to F, K to R, etc. (Yes, the redundant combinations are included.)\r\n\r\nFor reference, temperature conversion formulas are available at \u003chttp://en.wikipedia.org/wiki/Temperature_conversion\u003e.\r\n\r\nA follow-on problem (more difficult with string inputs) is located here: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/2415-temperature-conversion-utility-strings\u003e.","description_html":"\u003cp\u003eThere are a few problems on Cody regarding temperature conversion (C to K, C to F, F to C), but none include Rankine. Furthermore, they each involve simple one-liner solutions. For this problem, you are to write a utility function that takes a given temperature and two capital letters designating which temperature scale is being converted to which. For example, T_convertor(100,'C','F') requires 100 degrees Celsius be converted to Fahrenheit.\u003c/p\u003e\u003cp\u003eThe test suite includes all 16 possible combinations: C to F, C to R, C to C, C to K, K to F, K to R, etc. (Yes, the redundant combinations are included.)\u003c/p\u003e\u003cp\u003eFor reference, temperature conversion formulas are available at \u003ca href = \"http://en.wikipedia.org/wiki/Temperature_conversion\"\u003ehttp://en.wikipedia.org/wiki/Temperature_conversion\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eA follow-on problem (more difficult with string inputs) is located here: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2415-temperature-conversion-utility-strings\"\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/2415-temperature-conversion-utility-strings\u003c/a\u003e.\u003c/p\u003e","function_template":"function T_out = T_convertor(T,u1,u2)\r\n T_out = T;\r\nend","test_suite":"%%\r\nT = 100;\r\nu1 = 'C';\r\nu2 = 'F';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-212) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'C';\r\nu2 = 'R';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-671.67) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'C';\r\nu2 = 'C';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-100) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'C';\r\nu2 = 'K';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-373.15) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'K';\r\nu2 = 'F';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-(-279.67)) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'K';\r\nu2 = 'R';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-180) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'K';\r\nu2 = 'C';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-(-173.15)) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'K';\r\nu2 = 'K';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-100) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'F';\r\nu2 = 'F';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-100) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'F';\r\nu2 = 'R';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-559.67) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'F';\r\nu2 = 'C';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-37.7777778) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'F';\r\nu2 = 'K';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-310.9277778) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'R';\r\nu2 = 'F';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-(-359.67)) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'R';\r\nu2 = 'R';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-100) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'R';\r\nu2 = 'C';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-(-217.5944444)) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'R';\r\nu2 = 'K';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-55.5555556) \u003c eps)\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":50,"test_suite_updated_at":"2014-07-11T12:34:03.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-11T12:30:22.000Z","updated_at":"2026-04-03T03:09:06.000Z","published_at":"2014-07-11T12:34:03.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\u003eThere are a few problems on Cody regarding temperature conversion (C to K, C to F, F to C), but none include Rankine. Furthermore, they each involve simple one-liner solutions. For this problem, you are to write a utility function that takes a given temperature and two capital letters designating which temperature scale is being converted to which. For example, T_convertor(100,'C','F') requires 100 degrees Celsius be converted to Fahrenheit.\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 test suite includes all 16 possible combinations: C to F, C to R, C to C, C to K, K to F, K to R, etc. (Yes, the redundant combinations are included.)\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\u003eFor reference, temperature conversion formulas are available at\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://en.wikipedia.org/wiki/Temperature_conversion\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://en.wikipedia.org/wiki/Temperature_conversion\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\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA follow-on problem (more difficult with string inputs) is located here:\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/2415-temperature-conversion-utility-strings\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/2415-temperature-conversion-utility-strings\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":1378,"title":"Young's modulus","description":"Given a value of \u003chttp://en.wikipedia.org/wiki/Young_modulus Young's modulus\u003e (Y) expressed on MegaPascal, convert it to the units described on the string S.\r\n\r\nExample:\r\n\r\n Y = 200000 (MPa)\r\n S = kN/m^2\r\n\r\nreturn:\r\n\r\n y = 200000000","description_html":"\u003cp\u003eGiven a value of \u003ca href = \"http://en.wikipedia.org/wiki/Young_modulus\"\u003eYoung's modulus\u003c/a\u003e (Y) expressed on MegaPascal, convert it to the units described on the string S.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e Y = 200000 (MPa)\r\n S = kN/m^2\u003c/pre\u003e\u003cp\u003ereturn:\u003c/p\u003e\u003cpre\u003e y = 200000000\u003c/pre\u003e","function_template":"function y = convert_young(Y,S)\r\n  y = Y;\r\nend","test_suite":"%%\r\nY = 2e5;\r\nS = 'kN/m^2';\r\ny_correct = 2e8;\r\nassert(isequal(convert_young(Y,S),y_correct))\r\n\r\n\r\n%%\r\nY = 2e5;\r\nS = 'N/m^2';\r\ny_correct = 2e11;\r\nassert(isequal(convert_young(Y,S),y_correct))\r\n\r\n\r\n%%\r\nY = 2e5;\r\nS = 'kN/mm^2';\r\ny_correct = 2e2;\r\nassert(isequal(convert_young(Y,S),y_correct))\r\n\r\n\r\n%%\r\nY = 2e5;\r\nS = 'N/mm^2';\r\ny_correct = 2e5;\r\nassert(isequal(convert_young(Y,S),y_correct))\r\n\r\n\r\n%%\r\nY = 2e5;\r\nS = 'kN/cm^2';\r\ny_correct = 2e4;\r\nassert(isequal(convert_young(Y,S),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":3919,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":86,"test_suite_updated_at":"2013-03-25T14:30:46.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-03-23T18:30:14.000Z","updated_at":"2025-12-02T10:12:33.000Z","published_at":"2013-03-23T18:30: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\u003eGiven a value of\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://en.wikipedia.org/wiki/Young_modulus\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eYoung's modulus\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (Y) expressed on MegaPascal, convert it to the units described on the string S.\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\u003eExample:\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[ Y = 200000 (MPa)\\n S = kN/m^2]]\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\u003ereturn:\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[ y = 200000000]]\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":2046,"title":"Convert binary numbers to hexadecimal numbers","description":"Function must convert the input vector x composed of 0 and 1 (length is a multiple of 8) in hexadecimal. Most significant bit is first. each pair of hexadecimal symbols must be separated by space.\r\n\r\n*Example*:\r\n[1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1] will return 'F0 E1'","description_html":"\u003cp\u003eFunction must convert the input vector x composed of 0 and 1 (length is a multiple of 8) in hexadecimal. Most significant bit is first. each pair of hexadecimal symbols must be separated by space.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e:\r\n[1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1] will return 'F0 E1'\u003c/p\u003e","function_template":"function y = bin2hex(x)\r\n  y = 'AB CD';\r\nend","test_suite":"%%\r\nx = [1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1] ;\r\ny_correct = 'F0 E1';\r\nassert(isequal(bin2hex(x),y_correct));\r\n\r\n%%\r\nx = ones(1,80);\r\ny_correct = 'FF FF FF FF FF FF FF FF FF FF';\r\nassert(isequal(bin2hex(x),y_correct));\r\n\r\n%%\r\nx = zeros(1,8);\r\ny_correct = '00';\r\nassert(isequal(bin2hex(x),y_correct));\r\n\r\n%%\r\nx = '1 0 0 1 1 1 1 0 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 0 1 0 0 1 1 0 1 0';\r\ny_correct = '9E 6B E2 9A';\r\nassert(isequal(bin2hex(x),y_correct));","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":19725,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":46,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-12-13T15:48:33.000Z","updated_at":"2026-01-06T20:29:31.000Z","published_at":"2013-12-13T15:51:02.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\u003eFunction must convert the input vector x composed of 0 and 1 (length is a multiple of 8) in hexadecimal. Most significant bit is first. each pair of hexadecimal symbols must be separated by space.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: [1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1] will return 'F0 E1'\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":394,"title":"Convert String to Morse Code","description":"Convert a given string to international \u003chttp://en.wikipedia.org/wiki/Morse_code Morse Code\u003e\r\n\r\n* Strings will only have [A-z], [0-9] and space characters\r\n* A string must be returned with dots (.), dashes (-) and spaces between words\r\n\r\nFor example:\r\ngiven |str = 'MATLAB is good'| return |ystr = '--.--.-...--... ..... --.-------..'|\r\n","description_html":"\u003cp\u003eConvert a given string to international \u003ca href=\"http://en.wikipedia.org/wiki/Morse_code\"\u003eMorse Code\u003c/a\u003e\u003c/p\u003e\u003cul\u003e\u003cli\u003eStrings will only have [A-z], [0-9] and space characters\u003c/li\u003e\u003cli\u003eA string must be returned with dots (.), dashes (-) and spaces between words\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eFor example:\r\ngiven \u003ctt\u003estr = 'MATLAB is good'\u003c/tt\u003e return \u003ctt\u003eystr = '--.--.-...--... ..... --.-------..'\u003c/tt\u003e\u003c/p\u003e","function_template":"function ystr = morseCoder(str)\r\n  n = {'-----' '.----' '..---' '...--' '....-' '.....' '-....'...\r\n       '--...' '---..' '----.'};\r\n  c = {'.-' '-...' '-.-.' '-..' '.' '..-.' '--.' '....' '..'...\r\n       '.---' '-.-' '.-..' '--' '-.' '---' '.--.' '--.-' '.-.' '...'...\r\n       '-' '..-' '...-' '.--' '-..-' '-.--' '--..'};\r\n  ystr = str;\r\nend","test_suite":"%%\r\nx = 'MATLAB is good';\r\ny_correct = '--.--.-...--... ..... --.-------..';\r\nassert(isequal(morseCoder(x),y_correct))\r\n%%\r\nx = 'The quick brown fox jumps over the lazy dog';\r\ny_correct = '-..... --.-..-..-.-.-.- -....-.---.---. ..-.----..- .---..---.--.... ---...-..-. -..... .-...---..-.-- -..-----.';\r\nassert(isequal(morseCoder(x),y_correct))\r\n%%\r\nx = '01234567890 is a pallindrome';\r\ny_correct = '-----.----..---...--....-.....-....--...---..----.----- ..... .- .--..-.-...-....-.-...-.-----.';\r\nassert(isequal(morseCoder(x),y_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":1597,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":219,"test_suite_updated_at":"2012-02-24T02:55:18.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-02-24T02:55:18.000Z","updated_at":"2026-03-14T05:17:37.000Z","published_at":"2012-02-24T02:56: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\",\"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\u003eConvert a given string to international\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://en.wikipedia.org/wiki/Morse_code\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMorse Code\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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\u003eStrings will only have [A-z], [0-9] and space characters\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\u003eA string must be returned with dots (.), dashes (-) and spaces between words\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\u003eFor example: given\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \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\u003estr = 'MATLAB is good'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e return\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \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\u003eystr = '--.--.-...--... ..... --.-------..'\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":59237,"title":"Roman to Integer Conversion","description":"The idea behind this cody problem is to write a code that converts the Roman Numerals to Integers. \r\nA numeral system known as Roman numerals (I, V, X, L, C, D, M), were used in ancient Rome, where letters represented numbers. They were in use in Europe in the late middle ages. The conversion of the Roman numerals and their indian or arabic conversion is listed as follows:\r\n'I' = 1\r\n'V' = 5\r\n'X' = 10\r\n'L' = 50\r\n'C' = 100\r\n'D' = 500\r\n'M' = 1000\r\nHow the conversion works can be seen from this Wikipedia link\r\nhttps://en.wikipedia.org/wiki/Roman_numerals\r\nHave fun with the problem!\r\n","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: 423px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 211.5px; transform-origin: 407.5px 211.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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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 idea behind this cody problem is to write a code that converts the Roman Numerals to Integers. \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: 384.5px 31.5px; text-align: left; transform-origin: 384.5px 31.5px; white-space-collapse: preserve; 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 numeral system known as Roman numerals (I, V, X, L, C, D, M), were used in ancient Rome, where letters represented numbers. They were in use in Europe in the late middle ages. The conversion of the Roman numerals and their indian or arabic conversion is listed as follows:\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'I' = 1\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'V' = 5\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'X' = 10\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'L' = 50\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'C' = 100\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'D' = 500\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'M' = 1000\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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=\"\"\u003eHow the conversion works can be seen from this Wikipedia link\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Roman_numerals\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ehttps://en.wikipedia.org/wiki/Roman_numerals\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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=\"\"\u003eHave fun with the problem!\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function a = romanToInt(s)\r\n  s = x;\r\nend","test_suite":"%%\r\ns = 'I'\r\ny_correct = 1;\r\nassert(isequal(romanToInt(s),y_correct))\r\n\r\n%%\r\ns = 'XXXVIII'\r\ny_correct = 38;\r\nassert(isequal(romanToInt(s),y_correct))\r\n\r\n%%\r\ns = 'MCMLXXVII'\r\ny_correct = 1977\r\nassert(isequal(romanToInt(s),y_correct))\r\n\r\n%%\r\ns = 'MMXXXVIII'\r\ny_correct = 2038\r\nassert(isequal(romanToInt(s),y_correct))\r\n\r\n%%\r\ns = 'MCMXC'\r\ny_correct = 1990\r\nassert(isequal(romanToInt(s),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":2638670,"edited_by":2638670,"edited_at":"2023-11-27T19:10:56.000Z","deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-11-27T19:07:40.000Z","updated_at":"2025-05-10T15:37:27.000Z","published_at":"2023-11-27T19:10:57.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\u003eThe idea behind this cody problem is to write a code that converts the Roman Numerals to Integers. \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\u003eA numeral system known as Roman numerals (I, V, X, L, C, D, M), were used in ancient Rome, where letters represented numbers. They were in use in Europe in the late middle ages. The conversion of the Roman numerals and their indian or arabic conversion is listed as follows:\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'I' = 1\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'V' = 5\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'X' = 10\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'L' = 50\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'C' = 100\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'D' = 500\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'M' = 1000\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\u003eHow the conversion works can be seen from this Wikipedia link\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:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Roman_numerals\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttps://en.wikipedia.org/wiki/Roman_numerals\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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\u003eHave fun with the problem!\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\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":42859,"title":"Convert nested struct-array to numeric array","description":"Sometimes data happens to be nicely structured in a struct-array, distributed over various levels of the struct, according to the hierarchy in the logic of the data acquisition.\r\nFor fitting the data, the relevant elements of the struct-array need to be converted to a simple, multi-dimensional numeric array.\r\n\r\nThat will be your assignment.\r\n\r\nCreate a function struct2mat that takes a struct-array as an input, and returns an array, where dimensions of the output data correspond to the struc-array levels in incremental order. The first output level enters dimension 1 of the output, the 2nd dimension 2, etc.\r\n\r\n  datastruct(1).level2(1).level3(1).data = 1:4;\r\n  ...\r\n  datastruct(4).level2(3).level3(2).data = 4321:4324;\r\n\r\n  dataarray = struct2mat(datastruct)\r\n\r\nshould result in \r\n\r\n  dataarray(1,1,1,1) = 1;\r\n  ...\r\n  dataarray(1,1,1,4) = 4;\r\n  ...\r\n  dataarray(4,3,2,3) = 4323;\r\n\r\n\u003c\u003chttp://i64.tinypic.com/zkrbm1.jpg\u003e\u003e\r\n\r\nI encourage you to write a function that does not use loops to access the different struct-array levels.","description_html":"\u003cp\u003eSometimes data happens to be nicely structured in a struct-array, distributed over various levels of the struct, according to the hierarchy in the logic of the data acquisition.\r\nFor fitting the data, the relevant elements of the struct-array need to be converted to a simple, multi-dimensional numeric array.\u003c/p\u003e\u003cp\u003eThat will be your assignment.\u003c/p\u003e\u003cp\u003eCreate a function struct2mat that takes a struct-array as an input, and returns an array, where dimensions of the output data correspond to the struc-array levels in incremental order. The first output level enters dimension 1 of the output, the 2nd dimension 2, etc.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003edatastruct(1).level2(1).level3(1).data = 1:4;\r\n...\r\ndatastruct(4).level2(3).level3(2).data = 4321:4324;\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003edataarray = struct2mat(datastruct)\r\n\u003c/pre\u003e\u003cp\u003eshould result in\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003edataarray(1,1,1,1) = 1;\r\n...\r\ndataarray(1,1,1,4) = 4;\r\n...\r\ndataarray(4,3,2,3) = 4323;\r\n\u003c/pre\u003e\u003cimg src = \"http://i64.tinypic.com/zkrbm1.jpg\"\u003e\u003cp\u003eI encourage you to write a function that does not use loops to access the different struct-array levels.\u003c/p\u003e","function_template":"function mat = struct2mat(s)\r\n  c = struct2cell(s);\r\n  mat = [c{:}];\r\nend","test_suite":"%%\r\ndata_ref_temp = rand(5,4,3,2);\r\ndata.siz = size(data_ref_temp);\r\nglobal data\r\n\r\nfor i1 = 1:data.siz(1)\r\n    data.altitude.location(i1) = rand;\r\n    for i2 = 1:data.siz(2)\r\n        data.floor.location(i1).room(i2) = rand;\r\n        for i3 = 1:data.siz(3)\r\n            data.scale.location(i1).room(i2).device(i3) = rand;\r\n            for i4 = 1:data.siz(4)\r\n                data.temperature.location(i1).room(i2).device(i3).sample(i4) = data_ref_temp(i1,i2,i3,i4);\r\n                data.timestamp.location(i1).room(i2).device(i3).sample(i4) = i4;\r\n            end\r\n        end\r\n    end\r\nend\r\n\r\nassert(isequal(struct2mat(data.temperature),data_ref_temp))\r\n\r\n%%\r\nglobal data\r\ndata_ref_time = repmat(shiftdim(1:data.siz(4),-2),data.siz(1:3));\r\nassert(isequal(struct2mat(data.timestamp),data_ref_time))\r\n\r\n%%\r\nglobal data\r\nassert(isequal(struct2mat(data.altitude),data.altitude.location.'))\r\n\r\n%%\r\nglobal data\r\nassert(isequal(struct2mat(data.floor),cat(1,data.floor.location.room)))\r\n\r\n%%\r\nglobal data\r\ndata.scale.location;[ans.room];[ans.device];\r\nassert(isequal(struct2mat(data.scale),permute(reshape(ans,3,4,5),[3 2 1])))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":6556,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-05-23T07:59:17.000Z","updated_at":"2016-05-23T09:37:39.000Z","published_at":"2016-05-23T09:37:39.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\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/media/image1.JPEG\"}],\"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\u003eSometimes data happens to be nicely structured in a struct-array, distributed over various levels of the struct, according to the hierarchy in the logic of the data acquisition. For fitting the data, the relevant elements of the struct-array need to be converted to a simple, multi-dimensional numeric array.\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\u003eThat will be your assignment.\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 a function struct2mat that takes a struct-array as an input, and returns an array, where dimensions of the output data correspond to the struc-array levels in incremental order. The first output level enters dimension 1 of the output, the 2nd dimension 2, etc.\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[datastruct(1).level2(1).level3(1).data = 1:4;\\n...\\ndatastruct(4).level2(3).level3(2).data = 4321:4324;\\n\\ndataarray = struct2mat(datastruct)]]\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\u003eshould result in\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[dataarray(1,1,1,1) = 1;\\n...\\ndataarray(1,1,1,4) = 4;\\n...\\ndataarray(4,3,2,3) = 4323;]]\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: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=\\\"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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eI encourage you to write a function that does not use loops to access the different struct-array levels.\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\"},{\"partUri\":\"/media/image1.JPEG\",\"contentType\":\"image/JPEG\",\"content\":\"data:image/JPEG;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAEsASwDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwE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2Q==\"}]}"},{"id":2415,"title":"Temperature Conversion Utility (Strings)","description":"This is a follow-on problem to \u003chttp://www.mathworks.com/matlabcentral/cody/problems/2413-temperature-conversion-utility Problem 2413: Temperature Conversion Utility\u003e.\r\n\r\nYou are provided a cell array of strings that contains the source temperature and units (in various formats) and a separate cell array of strings that contains the target temperature units (in various formats). Produce a numerical vector of converted temperature values. \r\n\r\nExample:\r\n\r\n T_in  = {'100 Celsius', '50degF', '90K', strcat('111',char(176),'R')};  \r\n T_to  = {'R','C','degF','kelvin'}; \r\n T_out = [671.67 10 -297.67 61.6666667];\r\n\r\nFor reference, temperature conversion formulas are available on \u003chttp://en.wikipedia.org/wiki/Temperature_conversion Wikipedia\u003e.","description_html":"\u003cp\u003eThis is a follow-on problem to \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2413-temperature-conversion-utility\"\u003eProblem 2413: Temperature Conversion Utility\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eYou are provided a cell array of strings that contains the source temperature and units (in various formats) and a separate cell array of strings that contains the target temperature units (in various formats). Produce a numerical vector of converted temperature values.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e T_in  = {'100 Celsius', '50degF', '90K', strcat('111',char(176),'R')};  \r\n T_to  = {'R','C','degF','kelvin'}; \r\n T_out = [671.67 10 -297.67 61.6666667];\u003c/pre\u003e\u003cp\u003eFor reference, temperature conversion formulas are available on \u003ca href = \"http://en.wikipedia.org/wiki/Temperature_conversion\"\u003eWikipedia\u003c/a\u003e.\u003c/p\u003e","function_template":"function [T_out] = T_convertor_str(T_in,T_to)\r\n T_out = 1;\r\nend","test_suite":"%%\r\nT_in = {'100 Celsius', '50degF', '90K', strcat('111',char(176),'R')};\r\nT_to = {'R','C','degF','kelvin'};\r\nT_out = [671.67 10 -297.67 61.6666667];\r\neps = 1e-3;\r\nassert(sum(abs(T_convertor_str(T_in,T_to)-T_out)) \u003c eps)\r\n\r\n%%\r\nT_in = {'10C','20degC','30 Celsius','40 Centigrade',strcat('50',char(176),'C'),'60K','70 kelvin','80 FAHRENHEIT'};\r\nT_to = {'R','R','Rankine','deg R','R','R',strcat(char(176),'R'),'degR'};\r\nT_out = [509.67 527.67 545.67 563.67 581.67 108 126 539.67];\r\neps = 1e-3;\r\nassert(sum(abs(T_convertor_str(T_in,T_to)-T_out)) \u003c eps)\r\n\r\n%%\r\nT_in = {'100 DEGREES RANKINE','100degC','100K','100F','1000R','1000 centigrade','1000 deg F','1000 kelvin'};\r\nT_to = {'C','degC',strcat(char(176),'C'),'Celsius','centigrade','deg C','degrees Celsius','CENTIGRADE'};\r\nT_out = [-217.5944444 100 -173.15 37.7777778 282.4055556 1000 537.7777778 726.85];\r\neps = 1e-3;\r\nassert(sum(abs(T_convertor_str(T_in,T_to)-T_out)) \u003c eps)\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":29,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-11T18:21:42.000Z","updated_at":"2026-04-03T03:10:48.000Z","published_at":"2014-07-11T18:21: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\",\"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\u003eThis is a follow-on problem to\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/2413-temperature-conversion-utility\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 2413: Temperature Conversion Utility\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\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou are provided a cell array of strings that contains the source temperature and units (in various formats) and a separate cell array of strings that contains the target temperature units (in various formats). Produce a numerical vector of converted temperature values.\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\u003eExample:\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[ T_in  = {'100 Celsius', '50degF', '90K', strcat('111',char(176),'R')};  \\n T_to  = {'R','C','degF','kelvin'}; \\n T_out = [671.67 10 -297.67 61.6666667];]]\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\u003eFor reference, temperature conversion formulas are available on\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://en.wikipedia.org/wiki/Temperature_conversion\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eWikipedia\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":60783,"title":"Convert integers from base 10 to proper primary notation ","description":"This problem is the companion to Cody Problem 60782. The proper primary system of expressing non-negative numbers has three digits: m, x, and p, which correspond to -1, 0, and 1. The places in a proper primary number correspond to the prime numbers. For example, the number 6 would be ppm in proper primary notation because . Similarly, the number 20 would be ppxxp in proper primary notation. \r\nBecause integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a non-negative number can exist. However, numbers in proper primary notation adhere to the following requirement: when m, x, and p are replaced with 0, 1, and 2, respectively, the resulting decimal number is minimal.\r\nFor instance, 5 can be represented as pp, pxx, and pxxm; since 22 is smaller than 211 or 2100, pp is the proper primary representation of 5. The number 12 can be represented as pxpp and ppxx; since 2122 is less than 2211, pxpp is the proper primary representation of 12. The number -15 can be represented as mmmx and mmxpx; since 1 is less than 121, mmmx is the proper primary representation of -15. \r\nWrite a function to convert non-negative integers in base 10 to proper primary notation.","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: 279px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 139.5px; transform-origin: 408px 139.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: 385px 42px; text-align: left; transform-origin: 385px 42px; white-space-collapse: preserve; 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem is the companion to \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/60782-convert-integers-from-proper-primary-to-base-10\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003eCody Problem 60782\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eproper primary \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003esystem of expressing non-negative numbers has three digits: \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003em\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ex\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ep\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, which correspond to -1, 0, and 1. The places in a proper primary number correspond to the prime numbers. For example, the number 6 would be \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eppm\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in proper primary notation because \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUYAAAAkCAYAAAD1nJMVAAAAAXNSR0IArs4c6QAAC2VJREFUeF7tnXnwf9UYx9+pCBVKUsjSYinTmJLKWpQlKcmaJIxQaEEkpA0x2UppYiwZIlLWQiVLWiwzSX9EhUxRJFOilM5r5jkz93e7y7mfc+89937mnJnvfH+/7+fce57znHPe59k/Kym3zIHMgcyBzIEVOLBS5kfmQOZA5kDmwIocyMCYd0TmQOZA5kCJAxkY85bIHMgciOHAkyX9T9KFMS8Z8NknSVpF0s+6jJGBsQu3ct/MgcwBzwGwY19Jj5Z0oKTbJ8qae0v6iKSLJX1e0v9D6MzAGMKl3CdzIHOgyAFwAzDcSNJbJgyKnuZVJR0r6Zeh4LgIMK4s6RGSnihpa0lnSjpnSfYNC43o/aUlmU+eRubAEBx4gaQjJPH7j0MMMMA7Hyrpa5L2D1H7Q4GRfo+VdLCkPRxDfiXpKElnSfrPAJMY6pXYGk6U9NqaAW6T9AxJFwxFQMN7uXCe7+w1h0p6g91uCcjoPCR0P0fSu9x+2EbSPST9zUkTp0j6gKQbOr+x3wdQpV7u6NjPqVM7Sbq239cP9rb7OtDZW9Lr3YHe1PgKCKEOfkLS3wcbufnFAMx3JB3tMOHURDQw7CLrupudL/Yre7S2hQDjmpI+KelVDlD+LOnVks4N1dUTMq5q6M0k/UTS/WvoAuhf6C6AW0ek2wPiByU9RtK/nQT+tJkAI4f3ONsTtzi16h/u4nmwuzRRXWhXGmheMSI//VD+4MDXdST9yTScOQAjQsg3bD9UsY7L5rnuIr0kAV8PM+GBS/zmBOPHrCvPnu725C8c3cxjYWB8uN0O3FgAykucNHNdAmb0MSSXwEclPctuO6TDYvOetTEPDhLW2xywXC3pxZIeNiNg9Px8uqS9JF1qlyVAz+V5kkk5X5G0p3ku+1jHkHdwua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oSKA3d+uzJ+MF/KmSa/6cISNMISWpj5zA0bWne/SYJ/wu1w8Afs0aYHEN6bk66IHKHQ9hwBGVDwKRfD1AT+vIYRqURQC5pB3CYUKnVdVP58uDDimFoYWXVd4tXtbybY6YOTvqD7o4oQFULaJMlVkuOBoII6Kv+OpSp3y1bbQRc8xffFyUtwApxEbD2B8kzlRQjN42sbs+jlSK04cYiKhAeeXv5i6vquuf9/OF/aGr4T+LyuZ5is6U5+RG5lwCOaViq9kOJF88ARX0p7MJmrw9S3p9A2MW5mmVldMubi+Q82pac9hXsOJg/AUW2Jt0b296LoC7BST4UJBGKptbRW88bpSsp4Du4ZtLkIviP0hYyRlqlcoUykz9B4DerzONDJ2sNmgQjMPDnaKhkkCUKYc2oYFAqAHMR9w5KcPPvcNjFR3QRLHKeDTKolTRO0DNIlh7IPuRdaFGomvM9sc1bt9IwSNfF8uRwKlKU4c2/oExk1MAvT7tI222FCmtvdXfY76TnA4fOwSB7nIWOVnYtcVrYxSigh0jdXH24Cxj8nkd0yDA30Xqp3GrNJT0Xeh2vQzaqcACRztgAs9VW2BdipX7IEk/jmrlE8yRmPLwNjGofx55kDmQBUHcA5RvoufcgX3qXEM7Yb6sti662y2K9CcgXFqS5jpyRyYDweo7I+9kciUqX4XFKBIlg/mv+Bv/8zAOJ9NmCnNHJgiB0iOoJhKZSXsCRDMl4phT+z0lRMZGCewcpmEzIHMgWlxIAPjtNYjU5M5kDkwAQ5kYJzAImQSMgcyB6bFgQyM01qPTE3mQObABDiQgXECi5BJyBzIHJgWB+4CiJDsQ5Nw4hIAAAAASUVORK5CYII=\" width=\"163\" height=\"18\" style=\"width: 163px; height: 18px;\"\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Similarly, the number 20 would be \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eppxxp\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in proper primary notation. \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: 385px 31.5px; text-align: left; transform-origin: 385px 31.5px; white-space-collapse: preserve; 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBecause integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a non-negative number can exist. However, numbers 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eproper\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e primary notation adhere to the following requirement: when \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003em\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ex\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ep\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e are replaced with 0, 1, and 2, respectively, the resulting decimal number is minimal.\u003c/span\u003e\u003c/span\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: 385px 42px; text-align: left; transform-origin: 385px 42px; white-space-collapse: preserve; 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor instance, 5 can be represented 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epp\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epxx\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epxxm\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e; since 22 is smaller than 211 or 2100, \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epp\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is the proper primary representation of 5. The number 12 can be represented 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epxpp\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eppxx\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e; since 2122 is less than 2211, pxpp is the proper primary representation of 12. The number -15 can be represented 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003emmmx\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003emmxpx\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e; since 1 is less than 121, \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003emmmx\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is the proper primary representation of -15. \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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to convert non-negative integers in base 10 to proper primary notation.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function s = properPrimary(n)\r\n  s = dec2base(n,primes(n));\r\nend","test_suite":"%%\r\nn = 6;\r\ns = properPrimary(n);\r\ns_correct = 'ppm';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 20;\r\ns = properPrimary(n);\r\ns_correct = 'ppxxp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 0;\r\ns = properPrimary(n);\r\ns_correct = 'x';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 1;\r\ns = properPrimary(n);\r\ns_correct = 'pm';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 40;\r\ns = properPrimary(n);\r\ns_correct = 'pxppxpp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 280;\r\ns = properPrimary(n);\r\ns_correct = 'pxppppppppppxpp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 743;\r\ns = properPrimary(n);\r\ns_correct = 'ppppppppxppppppppppxpp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 153488;\r\ns = properPrimary(n);\r\ns_correct = 'pppppppppppppppppppppppppppppppppppppppppppxpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppxppppxp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 444555;\r\ns = properPrimary(n);\r\ns_correct = 'pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppxppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 2438900;\r\ns = properPrimary(n);\r\ns_correct = 'pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppxpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 5674321;\r\ns = properPrimary(n);\r\ns_correct = 'pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppxppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppx';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nfiletext = fileread('properPrimary.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'assert') || contains(filetext,'str2num'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":0,"comments_count":12,"created_by":46909,"edited_by":46909,"edited_at":"2025-04-06T16:52:52.000Z","deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":"2025-01-09T01:09:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2024-12-31T21:47:07.000Z","updated_at":"2026-03-15T22:17:28.000Z","published_at":"2024-12-31T21:47:42.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\u003eThis problem is the companion to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/60782-convert-integers-from-proper-primary-to-base-10\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCody Problem 60782\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. The \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eproper primary \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003esystem of expressing non-negative numbers has three digits: \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\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, \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\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and \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\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, which correspond to -1, 0, and 1. The places in a proper primary number correspond to the prime numbers. For example, the number 6 would be \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\u003eppm\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in proper primary notation because \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e6 = 5\\\\cdot 1 + 3\\\\cdot 1 + 2\\\\cdot(-1)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Similarly, the number 20 would be \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\u003eppxxp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in proper primary notation. \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\u003eBecause integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a non-negative number can exist. However, numbers in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eproper\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e primary notation adhere to the following requirement: when \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\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, \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\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and \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\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are replaced with 0, 1, and 2, respectively, the resulting decimal number is minimal.\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\u003eFor instance, 5 can be represented 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\u003epp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, \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\u003epxx\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and \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\u003epxxm\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e; since 22 is smaller than 211 or 2100, \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\u003epp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the proper primary representation of 5. The number 12 can be represented 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\u003epxpp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and \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\u003eppxx\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e; since 2122 is less than 2211, pxpp is the proper primary representation of 12. The number -15 can be represented 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\u003emmmx\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and \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\u003emmxpx\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e; since 1 is less than 121, \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\u003emmmx\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the proper primary representation of -15. \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 convert non-negative integers in base 10 to proper primary notation.\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\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":57978,"title":"Calculate BMI","description":"Given weight in kgs and height in metres, calculate body mass index","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 10.5px; transform-origin: 407.5px 10.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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 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 weight in kgs and height in metres, calculate body mass index\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = bmi(a,b)\r\n  y = [a,b];\r\nend","test_suite":"%%\r\na = 100;\r\nb=1.82\r\ny_correct = 30.18;\r\nassert(isequal(bmi(a,b),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":3,"created_by":2457335,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":34,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-04-13T23:51:12.000Z","updated_at":"2026-04-02T13:53:43.000Z","published_at":"2023-04-13T23:51:12.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\u003eGiven weight in kgs and height in metres, calculate body mass index\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":43010,"title":"kmph to mph converter","description":"Convert the speed in miles/hour to km/hour.","description_html":"\u003cp\u003eConvert the speed in miles/hour to km/hour.\u003c/p\u003e","function_template":"function y = mph2kmph(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 1.60934;\r\nassert(isequal(mph2kmph(x),y_correct))\r\n\r\n%%\r\nx = 10;\r\ny_correct = 16.0934;\r\nassert(isequal(mph2kmph(x),y_correct))\r\n\r\n%%\r\nx = 5;\r\ny_correct = 8.0467;\r\nassert(isequal(mph2kmph(x),y_correct))\r\n\r\n%%\r\nx = 50;\r\ny_correct = 80.467;\r\nassert(isequal(mph2kmph(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":0,"created_by":91311,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":194,"test_suite_updated_at":"2016-10-04T04:45:23.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-04T04:43:44.000Z","updated_at":"2026-03-29T19:27:46.000Z","published_at":"2016-10-04T04:43:44.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 the speed in miles/hour to km/hour.\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":42655,"title":"Convert yards to feet","description":"The goal of this script is to convert a value given in yards to feet.","description_html":"\u003cp\u003eThe goal of this script is to convert a value given in yards to feet.\u003c/p\u003e","function_template":"function y = yards_to_feet(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 9;\r\ny_correct = 27;\r\nassert(isequal(yards_to_feet(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":49473,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":562,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2015-10-07T19:17:28.000Z","updated_at":"2026-02-06T15:54:52.000Z","published_at":"2015-10-07T19:20:09.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\u003eThe goal of this script is to convert a value given in yards to feet.\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":43802,"title":"Energy-Mass Equivalence","description":"Given input enegy of the object, E, and constant c = 300,000,000, find the mass of the object.","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: 51px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 25.5px; transform-origin: 407px 25.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=\"\"\u003eIn a system's rest frame, given the enegy of an object, E (in Joules), find the rest mass of the object (in kilograms).\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=\"\"\u003eTake speed of light, c = 300,000,000 m/s.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function m = EnergyMass(E)\r\n  m;\r\nend","test_suite":"%%\r\nE = 5.490e+18;\r\ny_correct = 61;\r\nassert(isequal(EnergyMass(E),y_correct))\r\n\r\n%%\r\nE = 1.350e+19;\r\ny_correct = 25*6;\r\nassert(isequal(EnergyMass(E),y_correct))\r\n\r\n%%\r\nE = 9e16;\r\ny_correct = 1;\r\nassert(isequal(EnergyMass(E),y_correct))\r\n\r\n%%\r\nE = 1.17e18;\r\ny_correct = sqrt(169);\r\nassert(isequal(EnergyMass(E),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":100606,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":88,"test_suite_updated_at":"2021-02-21T11:53:56.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-12-13T23:20:40.000Z","updated_at":"2026-02-11T11:50:47.000Z","published_at":"2016-12-13T23:20:44.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 system's rest frame, given the enegy of an object, E (in Joules), find the rest mass of the object (in kilograms).\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\u003eTake speed of light, c = 300,000,000 m/s.\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":43214,"title":"Convert degrees to radians","description":"Given input in degrees, output to radians","description_html":"\u003cp\u003eGiven input in degrees, output to radians\u003c/p\u003e","function_template":"function y = DEG2RAD(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 180;\r\ny_correct = pi;\r\nassert(abs(DEG2RAD(x)-y_correct)\u003c0.01)\r\n%%\r\nx = -180;\r\ny_correct = -pi;\r\nassert(abs(DEG2RAD(x)-y_correct)\u003c0.01)\r\n%%\r\nx = 90;\r\ny_correct = pi/2;\r\nassert(abs(DEG2RAD(x)-y_correct)\u003c0.01)\r\n%%\r\nx = 45;\r\ny_correct = pi/4;\r\nassert(abs(DEG2RAD(x)-y_correct)\u003c0.01)\r\n","published":true,"deleted":false,"likes_count":11,"comments_count":0,"created_by":13865,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":313,"test_suite_updated_at":"2016-10-29T16:54:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-08T10:07:06.000Z","updated_at":"2026-03-03T22:24:46.000Z","published_at":"2016-10-08T10:07:06.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\u003eGiven input in degrees, output to radians\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":45281,"title":"A \"Complex\" Converter: Rectangular Form \u003c-\u003e Polar Form","description":"*BACKGROUND / MOTIVATION:*\r\n\r\nComplex numbers can be an important tool in an electrical engineer's toolbox because they can help us describe / work with sinusoidal signals.\r\n\r\nSinusoidal signals can be found all over the place in day-to-day life (in music, light, communication systems, power systems, etc.):\r\n\r\n* \"Why Study Sinusoids?\": \u003chttps://www.youtube.com/watch?v=yXjXJ5OlNyQ\u003e\r\n* \"Euler's formula\": \u003chttps://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-eulers-formula\u003e\r\n\r\nWhen working with complex numbers, sometimes it's easier to work with the \"rectangular/Cartesian form\" (z = x + j*y) and sometimes it's easier to work with the \"polar form\" (r ∠ θ).\r\n\r\n_An analogy:_\r\n\r\n* Using the rectangular form is sometimes like using decimals: it can make the numbers easier to add / subtract\r\n* Using the polar form is sometimes like using fractions: it can the numbers easier to multiply / divide\r\n* In the end, the two forms are equivalent, but sometimes they're easier to work with in one form instead of another.\r\n\r\n*PROBLEM DESCRIPTION*\r\n\r\nWrite a function which converts between the rectangular form and the polar form.\r\n\r\nYou can view a comparison of the two forms here:\r\n\u003chttps://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-complex-numbers\u003e\r\n\r\nThe variable \"form\" will be used to determine whether the function converts from rectangular to polar or from polar to rectangular.\r\n\r\nThe function takes the following inputs:\r\n\r\n* \"input1\" - a variable which is either \"x\" (the real component in rectangular form) or \"r\" (the radius in polar form)\r\n* \"input2\" - a variable which is either \"y\" (the complex component in rectangular form) or \"theta\" (the angle, in degrees, in polar form)\r\n* \"form\" - a variable which is set to either \"r2p\" (to convert from rectangular to polar) or \"p2r\" (to convert from polar to rectangular)\r\n\r\nThe function will output the variable \"output\" in the form of a column vector [output1;output2] where:\r\n\r\n* \"output1\" - a component of the output which is either \"x\" (the real component in rectangular form) or \"r\" (the radius in polar form)\r\n* \"output2\" - a component of the output which is either \"y\" (the complex component in rectangular form) or \"theta\" (the positive angle, in degrees, in polar form)\r\n\r\nThe test suite will round the components of your output vector to 4 decimal places.\r\n\r\n*FEEDBACK*\r\n\r\nPlease feel free to leave feedback on this problem in the comments!  :)","description_html":"\u003cp\u003e\u003cb\u003eBACKGROUND / MOTIVATION:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eComplex numbers can be an important tool in an electrical engineer's toolbox because they can help us describe / work with sinusoidal signals.\u003c/p\u003e\u003cp\u003eSinusoidal signals can be found all over the place in day-to-day life (in music, light, communication systems, power systems, etc.):\u003c/p\u003e\u003cul\u003e\u003cli\u003e\"Why Study Sinusoids?\": \u003ca href = \"https://www.youtube.com/watch?v=yXjXJ5OlNyQ\"\u003ehttps://www.youtube.com/watch?v=yXjXJ5OlNyQ\u003c/a\u003e\u003c/li\u003e\u003cli\u003e\"Euler's formula\": \u003ca href = \"https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-eulers-formula\"\u003ehttps://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-eulers-formula\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eWhen working with complex numbers, sometimes it's easier to work with the \"rectangular/Cartesian form\" (z = x + j*y) and sometimes it's easier to work with the \"polar form\" (r ∠ θ).\u003c/p\u003e\u003cp\u003e\u003ci\u003eAn analogy:\u003c/i\u003e\u003c/p\u003e\u003cul\u003e\u003cli\u003eUsing the rectangular form is sometimes like using decimals: it can make the numbers easier to add / subtract\u003c/li\u003e\u003cli\u003eUsing the polar form is sometimes like using fractions: it can the numbers easier to multiply / divide\u003c/li\u003e\u003cli\u003eIn the end, the two forms are equivalent, but sometimes they're easier to work with in one form instead of another.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cb\u003ePROBLEM DESCRIPTION\u003c/b\u003e\u003c/p\u003e\u003cp\u003eWrite a function which converts between the rectangular form and the polar form.\u003c/p\u003e\u003cp\u003eYou can view a comparison of the two forms here: \u003ca href = \"https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-complex-numbers\"\u003ehttps://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-complex-numbers\u003c/a\u003e\u003c/p\u003e\u003cp\u003eThe variable \"form\" will be used to determine whether the function converts from rectangular to polar or from polar to rectangular.\u003c/p\u003e\u003cp\u003eThe function takes the following inputs:\u003c/p\u003e\u003cul\u003e\u003cli\u003e\"input1\" - a variable which is either \"x\" (the real component in rectangular form) or \"r\" (the radius in polar form)\u003c/li\u003e\u003cli\u003e\"input2\" - a variable which is either \"y\" (the complex component in rectangular form) or \"theta\" (the angle, in degrees, in polar form)\u003c/li\u003e\u003cli\u003e\"form\" - a variable which is set to either \"r2p\" (to convert from rectangular to polar) or \"p2r\" (to convert from polar to rectangular)\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThe function will output the variable \"output\" in the form of a column vector [output1;output2] where:\u003c/p\u003e\u003cul\u003e\u003cli\u003e\"output1\" - a component of the output which is either \"x\" (the real component in rectangular form) or \"r\" (the radius in polar form)\u003c/li\u003e\u003cli\u003e\"output2\" - a component of the output which is either \"y\" (the complex component in rectangular form) or \"theta\" (the positive angle, in degrees, in polar form)\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThe test suite will round the components of your output vector to 4 decimal places.\u003c/p\u003e\u003cp\u003e\u003cb\u003eFEEDBACK\u003c/b\u003e\u003c/p\u003e\u003cp\u003ePlease feel free to leave feedback on this problem in the comments!  :)\u003c/p\u003e","function_template":"function [output] = complexConverter(input1, input2, form)\r\n  % write a function which converts from rectangular to polar and polar to rectangular\r\nend","test_suite":"%%Test1\r\ninput1 = 2; %x\r\ninput2 = 2; %y\r\nform = 'r2p';\r\noutput1 = 2.8284;\r\noutput2 = 45;\r\noutput = [output1;output2];\r\nassert(isequal(round(complexConverter(input1, input2, form),4),output))\r\n%%Test2\r\ninput1 = 3; %radius\r\ninput2 = 60; %degrees\r\nform = 'p2r';\r\noutput1 = 1.5000;\r\noutput2 = 2.5981;\r\noutput = [output1;output2];\r\nassert(isequal(round(complexConverter(input1, input2, form),4),output))\r\n%%Test3\r\ninput1 = 3; %x\r\ninput2 = -4; %y\r\nform = 'r2p';\r\noutput1 = 5.0000;\r\noutput2 = 306.8699;\r\noutput = [output1;output2];\r\nassert(isequal(round(complexConverter(input1, input2, form),4),output))\r\n%%Test4\r\ninput1 = 7; %radius\r\ninput2 = 225; %degrees\r\nform = 'p2r';\r\noutput1 = -4.9497;\r\noutput2 = -4.9497;\r\noutput = [output1;output2];\r\nassert(isequal(round(complexConverter(input1, input2, form),4),output))","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":377536,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":31,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-01-28T03:12:54.000Z","updated_at":"2025-12-29T14:25:32.000Z","published_at":"2020-02-25T00:35: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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eBACKGROUND / MOTIVATION:\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\u003eComplex numbers can be an important tool in an electrical engineer's toolbox because they can help us describe / work with sinusoidal signals.\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\u003eSinusoidal signals can be found all over the place in day-to-day life (in music, light, communication systems, power systems, etc.):\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\u003e\\\"Why Study Sinusoids?\\\":\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.youtube.com/watch?v=yXjXJ5OlNyQ\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://www.youtube.com/watch?v=yXjXJ5OlNyQ\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\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\u003e\\\"Euler's formula\\\":\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.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-eulers-formula\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-eulers-formula\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\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\u003eWhen working with complex numbers, sometimes it's easier to work with the \\\"rectangular/Cartesian form\\\" (z = x + j*y) and sometimes it's easier to work with the \\\"polar form\\\" (r ∠ θ).\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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAn analogy:\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\u003eUsing the rectangular form is sometimes like using decimals: it can make the numbers easier to add / subtract\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\u003eUsing the polar form is sometimes like using fractions: it can the numbers easier to multiply / divide\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\u003eIn the end, the two forms are equivalent, but sometimes they're easier to work with in one form instead of another.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ePROBLEM DESCRIPTION\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 which converts between the rectangular form and the polar form.\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\u003eYou can view a comparison of the two forms here:\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.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-complex-numbers\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-complex-numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\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 variable \\\"form\\\" will be used to determine whether the function converts from rectangular to polar or from polar to rectangular.\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 function takes the following inputs:\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\u003e\\\"input1\\\" - a variable which is either \\\"x\\\" (the real component in rectangular form) or \\\"r\\\" (the radius in polar form)\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\u003e\\\"input2\\\" - a variable which is either \\\"y\\\" (the complex component in rectangular form) or \\\"theta\\\" (the angle, in degrees, in polar form)\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\u003e\\\"form\\\" - a variable which is set to either \\\"r2p\\\" (to convert from rectangular to polar) or \\\"p2r\\\" (to convert from polar to rectangular)\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 function will output the variable \\\"output\\\" in the form of a column vector [output1;output2] where:\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\u003e\\\"output1\\\" - a component of the output which is either \\\"x\\\" (the real component in rectangular form) or \\\"r\\\" (the radius in polar form)\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\u003e\\\"output2\\\" - a component of the output which is either \\\"y\\\" (the complex component in rectangular form) or \\\"theta\\\" (the positive angle, in degrees, in polar form)\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 test suite will round the components of your output vector to 4 decimal places.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eFEEDBACK\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\u003ePlease feel free to leave feedback on this problem in the comments! :)\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":44429,"title":"Ounces to Kilograms","description":"convert ounces to kilograms, easy","description_html":"\u003cp\u003econvert ounces to kilograms, easy\u003c/p\u003e","function_template":"function kg = your_fcn_name(oz)\r\n kg = oz;\r\nend","test_suite":"%%test 1\r\nx = 50;\r\ny_correct = 1.417475\r\nassert(abs(your_fcn_name(x)-y_correct) \u003c 1e-4)\r\n\r\n%%test 2\r\nx = 100;\r\ny_correct = 2.83495\r\nassert(abs(your_fcn_name(x)-y_correct) \u003c 1e-4)\r\n\r\n%%test 3\r\nx = 500;\r\ny_correct = 14.17475\r\nassert(abs(your_fcn_name(x)-y_correct) \u003c 1e-4)\r\n\r\n%%test 4\r\nx = 1000;\r\ny_correct = 28.3495\r\nassert(abs(your_fcn_name(x)-y_correct) \u003c 1e-4)","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":156466,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":109,"test_suite_updated_at":"2018-01-04T19:23:15.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-12-02T15:32:52.000Z","updated_at":"2026-02-18T21:56:29.000Z","published_at":"2017-12-02T15:32:52.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 ounces to kilograms, easy\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":1603,"title":"Temperature conversion","description":"Convert temperature in degrees Celsius (C) to temperature in degrees Kelvin (K). Assume your answer is rounded to the nearest Kelvin.","description_html":"\u003cp\u003eConvert temperature in degrees Celsius (C) to temperature in degrees Kelvin (K). Assume your answer is rounded to the nearest Kelvin.\u003c/p\u003e","function_template":"function tK = celsius_to_kelvin(tC)\r\n  tK = 0;\r\nend","test_suite":"%%\r\ntC = 1;\r\ntK_correct = 274;\r\nassert(isequal(celsius_to_kelvin(tC),tK_correct))\r\n\r\n%%\r\ntC = -273;\r\ntK_correct = 0;\r\nassert(isequal(celsius_to_kelvin(tC),tK_correct))\r\n\r\n%%\r\ntC = 100;\r\ntK_correct = 373;\r\nassert(isequal(celsius_to_kelvin(tC),tK_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":14498,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":552,"test_suite_updated_at":"2013-06-10T19:45:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-06-06T15:13:07.000Z","updated_at":"2026-02-16T12:14:15.000Z","published_at":"2013-06-10T14:56:51.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 temperature in degrees Celsius (C) to temperature in degrees Kelvin (K). Assume your answer is rounded to the nearest Kelvin.\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":55425,"title":"Convert a given Character to its decimal equivalent value","description":"Convert a given character to its decimal equivalent value according to the ascii table. \r\nif x = '!';    y = 33;\r\nif x = 'u';   y = 117;\r\nhttps://www.asciitable.com/\r\n","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=\"\"\u003eConvert a given character to its decimal equivalent value according to the ascii table. \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=\"\"\u003eif x = '!';    y = 33;\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=\"\"\u003eif x = 'u';   y = 117;\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=\"\"\u003ehttps://www.asciitable.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: 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\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = char2dec(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'T';\r\ny_correct = 84;\r\nassert(isequal(char2dec(x),y_correct))\r\n%%\r\nx = 'R';\r\ny_correct = 82;\r\nassert(isequal(char2dec(x),y_correct))\r\n%%\r\nx = 'U';\r\ny_correct = 85;\r\nassert(isequal(char2dec(x),y_correct))\r\n%%\r\nx = 'M';\r\ny_correct = 77;\r\nassert(isequal(char2dec(x),y_correct))\r\n%%\r\nx = 'P';\r\ny_correct = 80;\r\nassert(isequal(char2dec(x),y_correct))\r\n%%\r\nx = '!';\r\ny_correct = 33;\r\nassert(isequal(char2dec(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":48917,"edited_by":48917,"edited_at":"2022-09-02T19:18:34.000Z","deleted_by":null,"deleted_at":null,"solvers_count":65,"test_suite_updated_at":"2022-09-02T19:18:05.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-09-02T19:15:20.000Z","updated_at":"2026-02-18T21:41:37.000Z","published_at":"2022-09-02T19:18:05.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\u003eConvert a given character to its decimal equivalent value according to the ascii table. \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\u003eif x = '!';    y = 33;\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\u003eif x = 'u';   y = 117;\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\u003ehttps://www.asciitable.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\u003e\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":2215,"title":"Power supply: 230V to 115V","description":"The problem is simple: we have a wall outlet which supplies 230V and an apparatus that requires 115V.\r\n\r\nSoftware is always cheaper than hardware (well, most of the time), so we solve this with a program, a Matlab function, to be precise.\r\n\r\nWrite a program that converts the supplied input voltage to the required output voltage.\r\n\r\n*If you like this problem, please like it (after solving).*","description_html":"\u003cp\u003eThe problem is simple: we have a wall outlet which supplies 230V and an apparatus that requires 115V.\u003c/p\u003e\u003cp\u003eSoftware is always cheaper than hardware (well, most of the time), so we solve this with a program, a Matlab function, to be precise.\u003c/p\u003e\u003cp\u003eWrite a program that converts the supplied input voltage to the required output voltage.\u003c/p\u003e\u003cp\u003e\u003cb\u003eIf you like this problem, please like it (after solving).\u003c/b\u003e\u003c/p\u003e","function_template":"function V_out = transformer(V_in)\r\n  N_primary = 5432; % Number of windings on primary coil.\r\n  N_secondary = 2716; % Number of windings on secondary coil.\r\n  V_out = N_secondary*i*V_in/N_primary; % Volt\r\nend","test_suite":"%%\r\nx = 230;\r\ny = transformer(x);\r\ny_correct = 115;\r\nif ~isequal(y,y_correct)\r\ndisp('That is not correct!');\r\ndisp('ÆÆÆÆÆÆÆÆÆÆÆÆÈØ8áÿèqBDüaZF$TWËF®H0ÑÓKÛÆÆÆÈÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆ');\r\ndisp('ÆÆÆÆÆÆÆÉÔ$ÜWÃ§Xwí/+«}{}º°{×}pÔ¿*/\u0026v\u0026F§ÉgÁÂÔÔÔÆÆÆÆÆÆÆÆÆÆÆÆ');\r\ndisp('ÆÆÆÆÆÆÔÔpæ¼í¢rîC/ìn[**ª°\"²_!*\\\"_^¬ï7\u0026¼n/V2¼ÿ§ÖHÔÆÆÆÆÆÆÆÆÆ');\r\ndisp('ÆÆÆÆWÐ0õCtîv½»¬°\"¡^¬°³;:²-::÷\";^¬¬³°÷¬(}(}{I¾$ÖE¶MÈÆÆÆÆÆÆ');\r\ndisp('ÆÆÆÛP9{{{ï{}ª°³º°²ª²,:::¨¨¨¸'';::¹¹;²ª*{}|¬}íí\u003ct=åÚBÔÕÆÆÆÆ');\r\ndisp('ÆÆÆÐÿj\u0026£j{/»°°³\"_;;¹;:¸.¸¨¸¸¸¨,¨,''^^°¬¡\"ª¦¦{¿{î46bôBÆÈÑÕÆ');\r\ndisp('ÆÆÆÕKC¿}¦º~²²!^;:¨¸¨¸¨¸··´·.¸¨¸¸¸:;::~~¯°÷÷{(*\u003c}íIàãK¶ÑÑÆ');\r\ndisp('ÆÆÔMýwri¦¯;'':''::¨´.¨  ··  ···`¨¨:;,,¨¨,;²\"°°°\"_°÷{r±¼FÛÆÆ');\r\ndisp('ÆÆ§Tî{¬¬º\":;,¸´¸``.··  · ·····´.´···..`¸¨:;__^¯\"÷{i{zagWÈ');\r\ndisp('ÆÆÖ¼l|²²\"¬²;¸.···   · ·   ······´.¨:_²¨`¸¨:;_ª°¬°¦»}[uaßN');\r\ndisp('ÈÔ©n/÷º\"\"_,¸´····    ·········.´¸¨:::-¹;,::;^°*|{+}}}\u003eJ5F');\r\ndisp('ÆpIc}*«÷²_:¨¸¸`·   ´¸.········.``¸¸¨,;­;;;:;­²\"ª÷¦}»}vI6ë');\r\ndisp('Èdc+¦/}÷\"-:''¨`··  ¨,`.·········´¸¸¸¸,:;_^-::'''';_¡*¦«)t=Yå');\r\ndisp('ÔAu}÷÷¡ª²¹''¸`¸·  ·¨''`.·.·······´``¸¨¨,;­°~:¨¨:;¹;ª¦{|ízÏß');\r\ndisp('Ðs{÷¬º¬_¹;¨¨¸´···¨,''¸`··········`¸¨¨::;-¡º::'':­¹¹^¯^°ºí%p');\r\ndisp('Ëõî}¬¬ª¬;:,´····´,:,,`´´´.····.·´¸¨¨'':­_\"¦­,:::_°¬*°¡\"¬{Y');\r\ndisp('§øL?}}*ª¡²''¸``·´¸::::¨¨_*I}_¨...`¸,^[ôî\\¬{¬;;_^²º¦¬ï{]l}}');\r\ndisp('ß5]«¬°¦{¦^:_ª^_,¸::''²;::_~^~;;¨`¨;¯){ti¬ìïº;^+t¿}*°}i\\tcî');\r\ndisp('ÆS%î}}¦ïI¦^²\"¬°;¸::''­::°nÊÊª^~^¨;(°¬ÊÊLz}*÷;¬ï±sVÌx{»/{?]');\r\ndisp('ÉKg4{¬¦î¼}¯;:_;£ç¦²:''¸,²:²:,:¡~:;}-:;¡°÷°²?{ÂÝ¾5ï5ntÍruz6');\r\ndisp('®k+÷°º¿ii;,;¨¬¸^áIi°¸´`¸¸´·´¨­²­''º*¹:;__²°C+¾án%Iå%j{tI½ç');\r\ndisp('Îv³°+{uu±°;;:*\u003e\"lz{t_¸······¨;¬_¨;{\";::;-¦=\"\u003eïîpîZhtï£awD');\r\ndisp('j)¬×{rxÍ©i¡^*_?¬²Y}c¬:`.····''^{:¸¨¡÷::-²²}{»{}{Y±aYao¢ô®W');\r\ndisp('\u0026l{{?Jnîz¿¬°ª¯lf¬C?ï°::¨´··¸:¬¿¬:;{}:::²°)JYjrYzADhZdÐ#ÆÆ');\r\ndisp('LÌl11îIì[ï°~~°~{ÞÊ©±*,::`.¸'':²²i±¼¦ª~^;²º[ÈÔÆmzôG§ÓÓ¶ÛÔÈÆ');\r\ndisp('WDîî{ïuîv]°\"^«¦÷¿àÕ§/¹::¸¨ªCPEGõ½ð®YCv¬\"}ÔÊÊÊÊËÓèÖÕÔÔÉÆÆÆ');\r\ndisp('ÈÔë±zI[{{÷\"ª°º*{zøÔÊ§¹;­'':\u0026I]tnu}Î¾n¦{\"÷1ÊÊÊÊÊÊÔ®ÖÆÆÆÆÆÆÆ');\r\ndisp('ÆÆÔK\u0026I\\*{*«*¦{{¿±ÆÊÊÊÕ÷°ª;;­:;­²^_­;-°}DÊÊÊÊÊÊÊÊÊÊÆÆÆÆÆÆÆ');\r\ndisp('ÆÆÆ#¶©x/il\\tîofbÊÊÊÊÊÊÊMz?²²;:¨¸¸¸'';ª¾ÊIÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÆË');\r\ndisp('ÆÆÆÆÆÆÖÐMÖdøFsÉÊÊÊÊÊÊÊªÎÆÊÊÖJ°-;-_²uÊV;MÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÆÆÆÆÆÆÆÆÆÆÈÈÊÊÊÊÊÊÊÊÊÊÊz··!3ÊÊÊÆMËÊë² vÊÔÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÆÆÆÆÆÆÆÆÆÆÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÖ¿  ·;¬÷²¸   ¦ÊÅÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÆÆÆÆÆÆÆÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ·  ·*42/\u0026bî^:¿ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÆÆÆÆÆÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ:´-ÊÊÊÊÊÊÖÔ^  ½ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÆÆËÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ· :ëÊÊÊÊÊÊ¬  PÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ   ²ÞÊÊÊÊÝ  WÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÉ    {ÊÊÊÊ² ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÅ   ¹ÊÊÊÊÊ:ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊg  µÊÊÊÊËÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ8·gÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ');\r\ndisp('Is this problem a hair-raiser?');\r\nend\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\n% On request of Ned Gulley, some extra testcases (for the, hopefully, stable voltage regulator within the input voltage range specified on the box).\r\nassert(isequal(transformer(173),115))\r\nassert(isequal(transformer(225),115))\r\nassert(isequal(transformer(145),115))\r\nassert(isequal(transformer(238),115))\r\nassert(isequal(transformer(163),115))\r\nassert(isequal(transformer(128),115))\r\nassert(isequal(transformer(216),115))\r\nassert(isequal(transformer(164),115))\r\nassert(isequal(transformer(136),115))\r\nassert(isequal(transformer(156),115))\r\nassert(isequal(transformer(166),115))\r\nassert(isequal(transformer(132),115))\r\nassert(isequal(transformer(162),115))\r\nassert(isequal(transformer(227),115))\r\nassert(isequal(transformer(203),115))\r\nassert(isequal(transformer(168),115))\r\nassert(isequal(transformer(174),115))\r\nassert(isequal(transformer(170),115))\r\nassert(isequal(transformer(161),115))\r\nassert(isequal(transformer(226),115))\r\nassert(isequal(transformer(232),115))\r\nassert(isequal(transformer(146),115))\r\nassert(isequal(transformer(151),115))\r\nassert(isequal(transformer(152),115))\r\nassert(isequal(transformer(193),115))\r\nassert(isequal(transformer(201),115))\r\nassert(isequal(transformer(192),115))\r\nassert(isequal(transformer(133),115))\r\nassert(isequal(transformer(137),115))\r\nassert(isequal(transformer(224),115))\r\nassert(isequal(transformer(200),115))\r\nassert(isequal(transformer(221),115))\r\nassert(isequal(transformer(160),115))\r\nassert(isequal(transformer(230),115))\r\nassert(isequal(transformer(176),115))\r\nassert(isequal(transformer(210),115))\r\nassert(isequal(transformer(159),115))\r\nassert(isequal(transformer(177),115))\r\nassert(isequal(transformer(126),115))\r\nassert(isequal(transformer(197),115))\r\nassert(isequal(transformer(141),115))\r\nassert(isequal(transformer(222),115))\r\nassert(isequal(transformer(189),115))\r\nassert(isequal(transformer(223),115))\r\nassert(isequal(transformer(140),115))\r\nassert(isequal(transformer(231),115))\r\nassert(isequal(transformer(236),115))\r\nassert(isequal(transformer(180),115))\r\nassert(isequal(transformer(191),115))\r\nassert(isequal(transformer(149),115))\r\nassert(isequal(transformer(172),115))\r\nassert(isequal(transformer(196),115))\r\nassert(isequal(transformer(135),115))\r\nassert(isequal(transformer(209),115))\r\nassert(isequal(transformer(144),115))\r\nassert(isequal(transformer(233),115))\r\nassert(isequal(transformer(215),115))\r\nassert(isequal(transformer(204),115))\r\nassert(isequal(transformer(187),115))\r\nassert(isequal(transformer(202),115))\r\nassert(isequal(transformer(217),115))\r\nassert(isequal(transformer(171),115))\r\nassert(isequal(transformer(153),115))\r\nassert(isequal(transformer(139),115))\r\nassert(isequal(transformer(148),115))\r\nassert(isequal(transformer(169),115))\r\nassert(isequal(transformer(130),115))\r\nassert(isequal(transformer(219),115))\r\nassert(isequal(transformer(206),115))\r\nassert(isequal(transformer(127),115))\r\nassert(isequal(transformer(129),115))\r\nassert(isequal(transformer(218),115))\r\nassert(isequal(transformer(220),115))\r\nassert(isequal(transformer(213),115))\r\nassert(isequal(transformer(207),115))\r\nassert(isequal(transformer(188),115))\r\nassert(isequal(transformer(179),115))\r\nassert(isequal(transformer(185),115))\r\nassert(isequal(transformer(131),115))\r\nassert(isequal(transformer(157),115))\r\nassert(isequal(transformer(143),115))\r\nassert(isequal(transformer(147),115))\r\nassert(isequal(transformer(138),115))\r\nassert(isequal(transformer(214),115))\r\nassert(isequal(transformer(178),115))\r\nassert(isequal(transformer(182),115))\r\nassert(isequal(transformer(195),115))\r\nassert(isequal(transformer(237),115))\r\nassert(isequal(transformer(155),115))\r\nassert(isequal(transformer(158),115))\r\nassert(isequal(transformer(199),115))\r\nassert(isequal(transformer(211),115))\r\nassert(isequal(transformer(228),115))\r\nassert(isequal(transformer(175),115))\r\nassert(isequal(transformer(150),115))\r\nassert(isequal(transformer(194),115))\r\nassert(isequal(transformer(134),115))\r\nassert(isequal(transformer(229),115))\r\nassert(isequal(transformer(181),115))\r\nassert(isequal(transformer(190),115))\r\nassert(isequal(transformer(165),115))\r\nassert(isequal(transformer(235),115))\r\nassert(isequal(transformer(239),115))\r\nassert(isequal(transformer(212),115))\r\nassert(isequal(transformer(208),115))\r\nassert(isequal(transformer(142),115))\r\nassert(isequal(transformer(198),115))\r\nassert(isequal(transformer(184),115))\r\nassert(isequal(transformer(240),115))\r\nassert(isequal(transformer(205),115))\r\nassert(isequal(transformer(234),115))\r\nassert(isequal(transformer(186),115))\r\nassert(isequal(transformer(183),115))\r\nassert(isequal(transformer(167),115))\r\nassert(isequal(transformer(154),115))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":6556,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":108,"test_suite_updated_at":"2014-02-26T08:04:49.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-02-24T15:36:09.000Z","updated_at":"2026-02-18T14:03:38.000Z","published_at":"2014-02-24T15:36:09.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\u003eThe problem is simple: we have a wall outlet which supplies 230V and an apparatus that requires 115V.\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\u003eSoftware is always cheaper than hardware (well, most of the time), so we solve this with a program, a Matlab function, to be precise.\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 program that converts the supplied input voltage to the required output voltage.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eIf you like this problem, please like it (after solving).\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":43830,"title":"MPS to MPH","description":"Given the speed in miles per second, find the speed in miles per hour.","description_html":"\u003cp\u003eGiven the speed in miles per second, find the speed in miles per hour.\u003c/p\u003e","function_template":"function mph = MPS2MPH(mps)\r\n  mph;\r\nend","test_suite":"%%\r\nmps = 40;\r\nmph_correct = 144000;\r\nassert(isequal(MPS2MPH(mps),mph_correct))\r\n\r\n%%\r\nmps = 5000;\r\nmph_correct = 18000000;\r\nassert(isequal(MPS2MPH(mps),mph_correct))\r\n\r\n%%\r\nmps = 186218;\r\nmph_correct = 670384800;\r\nassert(isequal(MPS2MPH(mps),mph_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":100606,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":158,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-12-17T04:03:25.000Z","updated_at":"2026-02-17T17:54:06.000Z","published_at":"2016-12-17T04:03:44.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\u003eGiven the speed in miles per second, find the speed in miles per hour.\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":49037,"title":"Temperature Conversion 1","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 10.5px; transform-origin: 332px 10.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: 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=\"\"\u003eGiven a temperature in Celcius, please convert it to Kelvin.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x-x^2;\r\nend","test_suite":"%%\r\nx = 0;\r\ny_correct = 273.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 10;\r\ny_correct = 283.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = -273.15;\r\ny_correct = 0;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 25;\r\ny_correct = 298.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 101;\r\ny_correct = 374.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = -3.15;\r\ny_correct = 270;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":16,"comments_count":1,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1797,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:30:19.000Z","updated_at":"2026-04-08T20:21:57.000Z","published_at":"2020-12-22T21:30:19.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\u003eGiven a temperature in Celcius, please convert it to Kelvin.\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":49052,"title":"Temperature Conversion 3","description":"Given a temperature in Celcius, convert it to Fahrenheit.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.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 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: 177px 8px; transform-origin: 177px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a temperature in Celcius, convert it to Fahrenheit.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x*7/3+66;\r\nend","test_suite":"%%\r\nfiletext = fileread('convert_stuff.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'regexp') || ...\r\n          contains(filetext, 'switch') || contains(filetext, 'if'); \r\nassert(~illegal)\r\n%%\r\nx = 0;\r\ny_correct = 32;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 5;\r\ny_correct = 41;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 20;\r\ny_correct = 68;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 40;\r\ny_correct = 104;\r\nassert(isequal(convert_stuff(x),y_correct))","published":true,"deleted":false,"likes_count":10,"comments_count":0,"created_by":180632,"edited_by":223089,"edited_at":"2022-12-11T07:11:44.000Z","deleted_by":null,"deleted_at":null,"solvers_count":1668,"test_suite_updated_at":"2022-12-11T07:11:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:41:39.000Z","updated_at":"2026-04-08T16:56:56.000Z","published_at":"2020-12-22T21:41:39.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\u003eGiven a temperature in Celcius, convert it to Fahrenheit.\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":2997,"title":"Kelvin to Celsius","description":"Degrees Celsius = degrees Kelvin - 273.15.\r\n\r\nGiven a temperature in Kelvin, return the equivalent temperature in Celsius.","description_html":"\u003cp\u003eDegrees Celsius = degrees Kelvin - 273.15.\u003c/p\u003e\u003cp\u003eGiven a temperature in Kelvin, return the equivalent temperature in Celsius.\u003c/p\u003e","function_template":"function y = kelvin(x)\r\n  y = x - 273.15 ;\r\nend","test_suite":"%%\r\nx = 360;\r\ny_correct = 86.85;\r\nassert(isequal(kelvin(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":35805,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":190,"test_suite_updated_at":"2015-02-10T22:22:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-02-10T22:15:31.000Z","updated_at":"2026-02-18T15:17:47.000Z","published_at":"2015-02-10T22:22:14.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\u003eDegrees Celsius = degrees Kelvin - 273.15.\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 a temperature in Kelvin, return the equivalent temperature in Celsius.\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":43215,"title":"Convert radians to degrees","description":"Given input in radians, output to degrees","description_html":"\u003cp\u003eGiven input in radians, output to degrees\u003c/p\u003e","function_template":"function y = RAD2DEG(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = pi;\r\ny_correct = 180;\r\nassert(abs(RAD2DEG(x)-y_correct)\u003c0.01)\r\n%%\r\nx = -pi;\r\ny_correct = -180;\r\nassert(abs(RAD2DEG(x)-y_correct)\u003c0.01)\r\n%%\r\nx = pi/2;\r\ny_correct = 90;\r\nassert(abs(RAD2DEG(x)-y_correct)\u003c0.01)\r\n%%\r\nx = pi/4;\r\ny_correct = 45;\r\nassert(abs(RAD2DEG(x)-y_correct)\u003c0.01)\r\n","published":true,"deleted":false,"likes_count":16,"comments_count":0,"created_by":13865,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2555,"test_suite_updated_at":"2016-10-29T16:53:32.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-08T10:09:08.000Z","updated_at":"2026-04-07T02:02:44.000Z","published_at":"2016-10-08T10:09:08.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\u003eGiven input in radians, output to degrees\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":44428,"title":"lb to kilogram","description":"convert lb to kilogram units, easy","description_html":"\u003cp\u003econvert lb to kilogram units, easy\u003c/p\u003e","function_template":"function kg = your_fcn_name(lb)\r\n  y = x;\r\nend","test_suite":"%%test 1\r\nx = 50;\r\ny_correct = 22.6796;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%% test 2\r\nx = 100;\r\ny_correct = 45.3592;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%test 3\r\nx = 500;\r\ny_correct = 226.7960;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":156466,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":97,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2017-12-02T15:19:47.000Z","updated_at":"2026-02-18T15:30:10.000Z","published_at":"2017-12-02T15:19:47.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 lb to kilogram units, easy\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":49047,"title":"Temperature Conversion 2","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 10.5px; transform-origin: 332px 10.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: 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=\"\"\u003eGiven a temperature in Fahrenheit, convert it to Kelvin\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x+sin(x);\r\nend","test_suite":"%%\r\nx = 32;\r\ny_correct = 273.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 68;\r\ny_correct = 293.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 104;\r\ny_correct = 313.15;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":8,"comments_count":2,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1655,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:38:47.000Z","updated_at":"2026-04-08T16:56:26.000Z","published_at":"2020-12-22T21:38:47.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\u003eGiven a temperature in Fahrenheit, convert it to Kelvin\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":1338,"title":"Binary Coder","description":"Take an input number and print the binary value of this number.","description_html":"\u003cp\u003eTake an input number and print the binary value of this number.\u003c/p\u003e","function_template":"function y = binary_coder(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 8;\r\ny_correct = 1000;\r\nassert(isequal(binary_coder(x),y_correct))\r\n\r\n%%\r\nx = 24;\r\ny_correct = 11000;\r\nassert(isequal(binary_coder(x),y_correct))","published":true,"deleted":false,"likes_count":6,"comments_count":0,"created_by":11534,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":273,"test_suite_updated_at":"2013-03-10T18:56:12.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-03-10T18:19:00.000Z","updated_at":"2026-03-27T18:21:15.000Z","published_at":"2013-03-10T18:19:00.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\u003eTake an input number and print the binary value of this number.\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":43672,"title":"String Array Basics, Part 2: Convert String Array to Cell Array; No Missing Values","description":"\u003chttp://www.mathworks.com/help/matlab/characters-and-strings.html String array\u003e and cell array are two types of containers for storing pieces of data. In this problem, you will be given a string array. Your job is to convert the string array to a cell array of character vectors, which stores the same pieces of text data.\r\n\r\nTo begin with, let's assume that there are no missing type values in the input string array. \r\n\r\nExample: \r\n\r\n  Input:\r\n  \u003e\u003e x = string({'I','love','MATLAB'})\r\n  x = \r\n    1×3 string array\r\n      \"I\"    \"love\"    \"MATLAB\";\r\n\r\n  Output:\r\n  \u003e\u003e y = {'I','love','MATLAB'}\r\n  y =\r\n    1×3 cell array\r\n      'I'    'love'    'MATLAB';\r\n\r\nRelated Problems in this series:\r\n\r\n* \u003chttp://www.mathworks.com/matlabcentral/cody/problems/43677-string-array-basics-part-1-convert-cell-array-to-string-array-no-missing-values   String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values\u003e \r\n* String Array Basics, Part 2: Convert String Array to Cell Array; No Missing Values\r\n* \u003chttp://www.mathworks.com/matlabcentral/cody/problems/43674-string-array-basics-part-3-convert-cell-array-to-string-array-with-missing-values   String Array Basics, Part 3: Convert Cell Array with Missing Values to String Array\u003e\r\n* \u003chttp://www.mathworks.com/matlabcentral/cody/problems/43673-string-array-basics-part-4-convert-string-array-to-cell-array-with-missing-values   String Array Basics, Part 4: Convert String Array with Missing Values to Cell Array\u003e","description_html":"\u003cp\u003e\u003ca href = \"http://www.mathworks.com/help/matlab/characters-and-strings.html\"\u003eString array\u003c/a\u003e and cell array are two types of containers for storing pieces of data. In this problem, you will be given a string array. Your job is to convert the string array to a cell array of character vectors, which stores the same pieces of text data.\u003c/p\u003e\u003cp\u003eTo begin with, let's assume that there are no missing type values in the input string array.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eInput:\r\n\u0026gt;\u0026gt; x = string({'I','love','MATLAB'})\r\nx = \r\n  1×3 string array\r\n    \"I\"    \"love\"    \"MATLAB\";\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003eOutput:\r\n\u0026gt;\u0026gt; y = {'I','love','MATLAB'}\r\ny =\r\n  1×3 cell array\r\n    'I'    'love'    'MATLAB';\r\n\u003c/pre\u003e\u003cp\u003eRelated Problems in this series:\u003c/p\u003e\u003cul\u003e\u003cli\u003e\u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/43677-string-array-basics-part-1-convert-cell-array-to-string-array-no-missing-values\"\u003eString Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values\u003c/a\u003e\u003c/li\u003e\u003cli\u003eString Array Basics, Part 2: Convert String Array to Cell Array; No Missing Values\u003c/li\u003e\u003cli\u003e\u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/43674-string-array-basics-part-3-convert-cell-array-to-string-array-with-missing-values\"\u003eString Array Basics, Part 3: Convert Cell Array with Missing Values to String Array\u003c/a\u003e\u003c/li\u003e\u003cli\u003e\u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/43673-string-array-basics-part-4-convert-string-array-to-cell-array-with-missing-values\"\u003eString Array Basics, Part 4: Convert String Array with Missing Values to Cell Array\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e","function_template":"function y = str2cell(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = string({'I','love','MATLAB'});\r\ny_correct = {'I','love','MATLAB'};\r\nassert(isequal(str2cell(x),y_correct))\r\n\r\n%%\r\nx = string({'I','love','MATLAB';'I','love','Cody'});\r\ny_correct = {'I','love','MATLAB'\r\n             'I','love','Cody'};\r\nassert(isequal(str2cell(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":12569,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":153,"test_suite_updated_at":"2016-11-23T06:40:34.000Z","rescore_all_solutions":false,"group_id":16,"created_at":"2016-11-21T01:00:23.000Z","updated_at":"2026-03-10T19:51:47.000Z","published_at":"2016-11-22T21:10:09.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:hyperlink w:docLocation=\\\"http://www.mathworks.com/help/matlab/characters-and-strings.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eString array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and cell array are two types of containers for storing pieces of data. In this problem, you will be given a string array. Your job is to convert the string array to a cell array of character vectors, which stores the same pieces of text data.\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\u003eTo begin with, let's assume that there are no missing type values in the input string array.\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\u003eExample:\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[Input:\\n\u003e\u003e x = string({'I','love','MATLAB'})\\nx = \\n  1×3 string array\\n    \\\"I\\\"    \\\"love\\\"    \\\"MATLAB\\\";\\n\\nOutput:\\n\u003e\u003e y = {'I','love','MATLAB'}\\ny =\\n  1×3 cell array\\n    'I'    'love'    'MATLAB';]]\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\u003eRelated Problems in this series:\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/43677-string-array-basics-part-1-convert-cell-array-to-string-array-no-missing-values\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eString Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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\u003eString Array Basics, Part 2: Convert String Array to Cell Array; No Missing Values\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/43674-string-array-basics-part-3-convert-cell-array-to-string-array-with-missing-values\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eString Array Basics, Part 3: Convert Cell Array with Missing Values to String Array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/43673-string-array-basics-part-4-convert-string-array-to-cell-array-with-missing-values\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eString Array Basics, Part 4: Convert String Array with Missing Values to Cell Array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":2204,"title":"Convert a vector of Integers into a matrix of binaries","description":"Convert a vector of positive integers into a matrix containing their binary representation. Each column of the output contains the binary representation. The least significant bit is at the top.\r\n\r\nExample\r\n\r\n input  = [1 2 3 4]\r\n\r\n output = [1 0 1 0\r\n           0 1 1 0\r\n           0 0 0 1]\r\n","description_html":"\u003cp\u003eConvert a vector of positive integers into a matrix containing their binary representation. Each column of the output contains the binary representation. The least significant bit is at the top.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cpre\u003e input  = [1 2 3 4]\u003c/pre\u003e\u003cpre\u003e output = [1 0 1 0\r\n           0 1 1 0\r\n           0 0 0 1]\u003c/pre\u003e","function_template":"function y = MakeBitPattern(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [1 2 3 4 5];\r\ny_correct = [1     0     1     0     1;...\r\n             0     1     1     0     0;...\r\n             0     0     0     1     1];\r\nassert(isequal(MakeBitPattern(x),y_correct))\r\n\r\n%%\r\nx = [1 15];\r\ny_correct = [1     1;...\r\n             0     1;...\r\n             0     1;...\r\n             0     1];\r\nassert(isequal(MakeBitPattern(x),y_correct))\r\n\r\n%%\r\nx = [255 127 63 31 15 7 3 1];\r\ny_correct = [1     1     1     1     1     1     1     1;...\r\n             1     1     1     1     1     1     1     0;...\r\n             1     1     1     1     1     1     0     0;...\r\n             1     1     1     1     1     0     0     0;...\r\n             1     1     1     1     0     0     0     0;...\r\n             1     1     1     0     0     0     0     0;...\r\n             1     1     0     0     0     0     0     0;...\r\n             1     0     0     0     0     0     0     0]\r\nassert(isequal(MakeBitPattern(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":9342,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":81,"test_suite_updated_at":"2018-10-18T06:30:32.000Z","rescore_all_solutions":true,"group_id":45,"created_at":"2014-02-21T14:40:25.000Z","updated_at":"2026-03-24T13:34:30.000Z","published_at":"2014-02-21T14:54: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\",\"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\u003eConvert a vector of positive integers into a matrix containing their binary representation. Each column of the output contains the binary representation. The least significant bit is at the top.\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\u003eExample\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[ input  = [1 2 3 4]\\n\\n output = [1 0 1 0\\n           0 1 1 0\\n           0 0 0 1]]]\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":49082,"title":"Energy Conversion 1","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.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 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: 239px 8px; transform-origin: 239px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven an energy in the unit of BTU (British Thermal Unit), convert it to Joule.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x+273.15;\r\nend","test_suite":"%%\r\nx = 123;\r\ny_correct = 129772.38;\r\nassert(abs(convert_stuff(x)-y_correct)\u003c1e-4)\r\n\r\n%%\r\nx = 0.015;\r\ny_correct = 15.8259;\r\nassert(abs(convert_stuff(x)-y_correct)\u003c1e-4)\r\n\r\n%%\r\nx = 66.3;\r\ny_correct = 69950.478;\r\nassert(abs(convert_stuff(x)-y_correct)\u003c1e-4)","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1039,"test_suite_updated_at":"2021-03-22T11:36:52.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T22:07:55.000Z","updated_at":"2026-04-08T21:05:41.000Z","published_at":"2020-12-22T22:07:55.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\u003eGiven an energy in the unit of BTU (British Thermal Unit), convert it to Joule.\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":8045,"title":"Gold Standard","description":"Gold has long been used as currency and a standard for currency, due to its inherent value and rarity. Historical data for gold is available at \u003chttp://measuringworth.com/gold/ Measuring Worth\u003e.\r\n\r\nFor this problem, you will be provided with a historical year (HY) and a historical value (HV) in dollars. The function template includes data from the previously mentioned site for the value (in dollars) of an ounce of gold (GV) from 1791 to 2014. Write a function to determine the current value (CV) in dollars assuming that the gold standard can be accurately used to convert between years. Round the result to two decimal places. If HY is outside of the historical-data range, return NaN.\r\n\r\nAs an example, with HY = 2000 and HV = 1000:\r\n\r\n* GV(HY=2000) = $280.10\r\n* N = 1000/280.10 = 3.57 (ounces of gold)\r\n* CV = 3.57*1270 (current $/ounce of gold) = $4534.09.\r\n","description_html":"\u003cp\u003eGold has long been used as currency and a standard for currency, due to its inherent value and rarity. Historical data for gold is available at \u003ca href = \"http://measuringworth.com/gold/\"\u003eMeasuring Worth\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eFor this problem, you will be provided with a historical year (HY) and a historical value (HV) in dollars. The function template includes data from the previously mentioned site for the value (in dollars) of an ounce of gold (GV) from 1791 to 2014. Write a function to determine the current value (CV) in dollars assuming that the gold standard can be accurately used to convert between years. Round the result to two decimal places. If HY is outside of the historical-data range, return NaN.\u003c/p\u003e\u003cp\u003eAs an example, with HY = 2000 and HV = 1000:\u003c/p\u003e\u003cul\u003e\u003cli\u003eGV(HY=2000) = $280.10\u003c/li\u003e\u003cli\u003eN = 1000/280.10 = 3.57 (ounces of gold)\u003c/li\u003e\u003cli\u003eCV = 3.57*1270 (current $/ounce of gold) = $4534.09.\u003c/li\u003e\u003c/ul\u003e","function_template":"function [CV] = gold_standard(HY,HV)\r\n\r\nY = 1791:2014;\r\nGV = [19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 20.1, 21.64, 20.95, 19.46, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.94, 20.69, 20.69, 21.64, 20.86, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.7, 20.67, 20.67, 20.67, 20.67, 23.42, 30.02, 42.03, 32.52, 29.13, 28.57, 28.88, 27.49, 23.75, 23.09, 23.24, 23.52, 22.99, 23.75, 23.05, 21.66, 20.84, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 24.44, 34.94, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 39.26, 41.51, 36.41, 41.25, 58.6, 97.81, 159.74, 161.49, 125.32, 148.31, 193.55, 307.5, 612.56, 459.64, 375.91, 424, 360.66, 317.66, 368.24, 447.95, 438.31, 382.58, 384.93, 363.29, 344.97, 360.91, 385.42, 385.5, 389.09, 332.39, 295.24, 279.91, 280.1, 272.22, 311.33, 364.8, 410.52, 446, 606, 699, 874, 975, 1227, 1572, 1700, 1415, 1270];\r\n\r\nCV = 1;\r\n\r\nend\r\n","test_suite":"%% current check\r\nHY = 2014; HV = 1270; CV_corr = 1270;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%% out-of-range check 1\r\nHY = 500; HV = 50; CV_corr = NaN;\r\nassert(isnan(gold_standard(HY,HV)))\r\n\r\n%% out-of-range check 2\r\nHY = 2500; HV = 5000; CV_corr = NaN;\r\nassert(isnan(gold_standard(HY,HV)))\r\n\r\n%%\r\nHY = 2010; HV = 1000; CV_corr = 1035.04;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 2005; HV = 1000; CV_corr = 2847.53;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 2000; HV = 1000; CV_corr = 4534.09;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1995; HV = 1000; CV_corr = 3294.42;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1990; HV = 1000; CV_corr = 3299.3;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1950; HV = 1000; CV_corr = 36285.71;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1900; HV = 1000; CV_corr = 61441.7;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1850; HV = 1000; CV_corr = 61441.7;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1800; HV = 1000; CV_corr = 65497.68;\r\nassert(abs(gold_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":63,"test_suite_updated_at":"2015-03-30T16:49:21.000Z","rescore_all_solutions":false,"group_id":30,"created_at":"2015-03-30T15:58:58.000Z","updated_at":"2026-03-24T03:34:47.000Z","published_at":"2015-03-30T15:58: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\u003eGold has long been used as currency and a standard for currency, due to its inherent value and rarity. Historical data for gold is available at\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://measuringworth.com/gold/\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMeasuring Worth\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\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor this problem, you will be provided with a historical year (HY) and a historical value (HV) in dollars. The function template includes data from the previously mentioned site for the value (in dollars) of an ounce of gold (GV) from 1791 to 2014. Write a function to determine the current value (CV) in dollars assuming that the gold standard can be accurately used to convert between years. Round the result to two decimal places. If HY is outside of the historical-data range, return NaN.\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\u003eAs an example, with HY = 2000 and HV = 1000:\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\u003eGV(HY=2000) = $280.10\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\u003eN = 1000/280.10 = 3.57 (ounces of gold)\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\u003eCV = 3.57*1270 (current $/ounce of gold) = $4534.09.\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":540,"title":"Convert hex color specification to MATLAB RGB","description":"Here's something that comes up all the time if you deal with web pages.\r\n\r\nGiven a \u003chttp://www.w3schools.com/html/html_colors.asp hexadecimal color specification\u003e of the form #FFFFFF, convert it to a 3 element MATLAB color specification. Remember that MATLAB RGB color values are between 0 and 1.\r\n\r\nThe input is a string starting with '#'. The output should be a 1-by-3 vector.\r\n\r\nExamples:\r\n\r\n Input  '#0000FF'\r\n Output [0 0 1]\r\n \r\n Input  '#33FF00'\r\n Output [0.2 1 0]","description_html":"\u003cp\u003eHere's something that comes up all the time if you deal with web pages.\u003c/p\u003e\u003cp\u003eGiven a \u003ca href=\"http://www.w3schools.com/html/html_colors.asp\"\u003ehexadecimal color specification\u003c/a\u003e of the form #FFFFFF, convert it to a 3 element MATLAB color specification. Remember that MATLAB RGB color values are between 0 and 1.\u003c/p\u003e\u003cp\u003eThe input is a string starting with '#'. The output should be a 1-by-3 vector.\u003c/p\u003e\u003cp\u003eExamples:\u003c/p\u003e\u003cpre\u003e Input  '#0000FF'\r\n Output [0 0 1]\u003c/pre\u003e\u003cpre\u003e Input  '#33FF00'\r\n Output [0.2 1 0]\u003c/pre\u003e","function_template":"function rgb = color_hex2rgb(hex)\r\n  rgb = [0 0 0];\r\nend","test_suite":"%%\r\nhex =  '#0000FF';\r\nrgb = [0 0 1];\r\nassert(isequal(color_hex2rgb(hex),rgb))\r\n\r\n%%\r\nhex =  '#33FF00';\r\nrgb = [0.2 1 0];\r\nassert(isequal(color_hex2rgb(hex),rgb))\r\n\r\n%%\r\nhex =  '#FFCCFF';\r\nrgb = [1 0.8 1];\r\nassert(isequal(color_hex2rgb(hex),rgb))\r\n\r\n%%\r\nhex =  '#999999';\r\nrgb = [.6 .6 .6];\r\nassert(isequal(color_hex2rgb(hex),rgb))","published":true,"deleted":false,"likes_count":7,"comments_count":0,"created_by":7,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":257,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-30T18:18:52.000Z","updated_at":"2026-04-09T08:38:53.000Z","published_at":"2012-03-30T18:26: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\u003eHere's something that comes up all the time if you deal with web pages.\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\u003eGiven a\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.w3schools.com/html/html_colors.asp\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehexadecimal color specification\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e of the form #FFFFFF, convert it to a 3 element MATLAB color specification. Remember that MATLAB RGB color values are between 0 and 1.\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 input is a string starting with '#'. The output should be a 1-by-3 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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExamples:\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[ Input  '#0000FF'\\n Output [0 0 1]\\n\\n Input  '#33FF00'\\n Output [0.2 1 0]]]\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":49077,"title":"Velocity Conversion ","description":"Given a velocity in mph, convert it to km/h. Round the answer to the fourth decimal place.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20px; 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: normal; text-decoration: none; white-space: normal; \"\u003e\u003cdiv style=\"display: block; min-width: 0px; padding-top: 0px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-bottom: 9px; margin-left: 4px; margin-right: 10px; margin-top: 2px; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"display: inline; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; \"\u003e\u003cspan style=\"\"\u003eGiven a velocity in mph, convert it to km/h. Round the answer to the fourth decimal place.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x*fast;\r\nend","test_suite":"%%\r\nx = 11;\r\ny_correct = 17.7027;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 45;\r\ny_correct = 72.4203;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 80;\r\ny_correct = 128.7472;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":10,"comments_count":8,"created_by":180632,"edited_by":26769,"edited_at":"2022-04-12T14:19:48.000Z","deleted_by":null,"deleted_at":null,"solvers_count":1669,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T22:04:31.000Z","updated_at":"2026-04-08T21:01:26.000Z","published_at":"2020-12-22T22:04:31.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\u003eGiven a velocity in mph, convert it to km/h. Round the answer to the fourth decimal place.\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":45327,"title":"Decimal to binary conversion (without using built-in function)","description":"convert the given decimal number to its equivalent binary without using built-in function.\r\n\r\n* n=18\r\n* out='10010'","description_html":"\u003cp\u003econvert the given decimal number to its equivalent binary without using built-in function.\u003c/p\u003e\u003cul\u003e\u003cli\u003en=18\u003c/li\u003e\u003cli\u003eout='10010'\u003c/li\u003e\u003c/ul\u003e","function_template":"function y = bin_conv(d)\r\n  y = x;\r\nend","test_suite":"%%\r\nassert(isequal(bin_conv(17),dec2bin(17)))\r\n%%\r\nassert(isequal(bin_conv(2),dec2bin(2)))\r\n%%\r\nassert(isequal(bin_conv(107),dec2bin(107)))\r\n%%\r\nassert(isequal(bin_conv(223),dec2bin(223)))\r\n%%\r\nassert(isequal(bin_conv(2437),dec2bin(2437)))\r\n%%\r\nassert(isequal(bin_conv(55),dec2bin(55)))\r\n%%\r\nassert(isequal(bin_conv(55.55),dec2bin(55.55)))\r\n%%\r\nfiletext = fileread('bin_conv.m');\r\nassert(isempty(strfind(filetext, 'dec2bin')),'dec2bin() forbidden')\r\nassert(isempty(strfind(filetext, 'de2bi')),'de2bi() forbidden')\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2020-02-14T20:11:13.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-02-14T20:03:27.000Z","updated_at":"2026-02-21T13:51:55.000Z","published_at":"2020-02-14T20:11:13.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\u003econvert the given decimal number to its equivalent binary without using built-in function.\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\u003en=18\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\u003eout='10010'\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":60782,"title":"Convert integers from primary notation to base 10 ","description":"The primary system of expressing numbers has three digits: m, x, and p, which correspond to -1, 0, and 1. The places in a primary number correspond to the prime numbers. For example, the number 6 could be ppm in primary notation because . Similarly, the number 20 could be ppxxp in primary notation. \r\nBecause integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a number can exist. Cody Problem 60783 deals with proper primary notation.  \r\nWrite a function to convert integers expressed in primary notation to base 10. ","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 145.5px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 72.75px; transform-origin: 407px 72.75px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 64.5px; 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 32.25px; text-align: left; transform-origin: 384px 32.25px; white-space-collapse: preserve; 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: 14.5px 8px; transform-origin: 14.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe \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: 25.5px 8px; transform-origin: 25.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eprimary \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: 150px 8px; transform-origin: 150px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003esystem of expressing numbers has three digits: \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: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003em\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: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \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: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003ex\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: 18px 8px; transform-origin: 18px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, 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: 4px 8px; transform-origin: 4px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003ep\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: 160px 8px; transform-origin: 160px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, which correspond to -1, 0, and 1. The places in a primary number correspond to the prime numbers. For example, the number 6 could be \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: 12px 8px; transform-origin: 12px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 12px 8.5px; transform-origin: 12px 8.5px; \"\u003eppm\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: 91.5px 8px; transform-origin: 91.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in primary notation because \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUYAAAAlCAYAAAA+wECwAAAIV0lEQVR4Xu2dTeh3QxTHPXsSViwoLIiw8BaxkCgloRCSIi8LWcgTFpKEsJGFl1KS95KUlJcsSHkthVigSJ6Vt9hzPnVPzXP73Tuvd2bu7fzq9Dz9f3Pnnvmeme+cOWdmfnsOsI8hYAgYAobAfgjsMTwMAUPAEDAE9kfAiNF6hCFgCBgCIwSMGK1LGAKGgCFgxGh9wBAwBAoicJrUdbTIqwXrLFnVBVLZnyKfx1RqHmMMWlbWEDAEXAQgxSdELhL5o1NoDhW9XhZ5Q+SpUB1TiREWZpZAvux4tgjFQcv1PvvFtsfKGwJLIcBYeV7k7I5JUdsOOX4s8ngoOcYQI2R4wzA7fCv/PifynsiPSyG/UL24/FdM1P2v/P2Uhm26Rd59r8glIlGu/0JYhVaL3peKnCVyoMg+kY9Ebu1g0DAo7hK5VuSI0AZ1UE71vlh0OW7Qpxdc0e1nkctF3m2EVaxdKf9N6NgKIUZ1RSFGDHO/SLBL2gi0qdceI1/8MKMTRr6wgc5KiIcP7z5d/l0LMepE873o/LfICQM50pSWE40OHMgZskaXgxrYNuWVeGNvimh/GNfREld0+WQgxitTGpf5TI5d75Z3XydyvE8HHzG6BvpUKrttRQN2V9sZxCeJ3D4BzBfy95qxEvC9cdDlaodQ1kKMT4vO5w54up4DHfDBoV2vyb+1BxDvu0zkL5GbBj3WRIzfic4Hi7wg8v6gP96Z20datQcH6R2RY0VqrxZL2PW3Ade9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(-1)\" style=\"width: 163px; height: 18.5px;\"\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: 110.5px 8px; transform-origin: 110.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Similarly, the number 20 could be \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: 20px 8px; transform-origin: 20px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; perspective-origin: 20px 8.5px; transform-origin: 20px 8.5px; \"\u003eppxxp\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: 64.5px 8px; transform-origin: 64.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in primary notation. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; 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 21px; text-align: left; transform-origin: 384px 21px; white-space-collapse: preserve; 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: 380px 8px; transform-origin: 380px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBecause integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a number can exist. \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/60783\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 60783\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: 35px 8px; transform-origin: 35px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e deals with \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: 21px 8px; transform-origin: 21px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eproper\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: 59px 8px; transform-origin: 59px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e primary notation.  \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-collapse: preserve; 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: 245px 8px; transform-origin: 245px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to convert integers expressed in primary notation to base 10. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = primary2dec(s)\r\n  y = base2dec(s,'primes')\r\nend","test_suite":"%%\r\nassert(isequal(primary2dec('ppm'),6))\r\n\r\n%%\r\nassert(isequal(primary2dec('ppxxp'),20))\r\n\r\n%%\r\nassert(isequal(primary2dec('x'),0))\r\n\r\n%%\r\nassert(isequal(primary2dec('pm'),1))\r\n\r\n%%\r\nassert(isequal(primary2dec('mp'),-1))\r\n\r\n%%\r\nassert(isequal(primary2dec('pxxpp'),16))\r\n\r\n%%\r\nassert(isequal(primary2dec('pxppxp'),27))\r\n\r\n%%\r\nassert(isequal(primary2dec('ppppp'),28))\r\n\r\n%%\r\nassert(isequal(primary2dec('mmmmpm'),-35))\r\n\r\n%%\r\nassert(isequal(primary2dec('mmxmmxmm'),-59))\r\n\r\n%%\r\nassert(isequal(primary2dec('pppppppm'),73))\r\n\r\n%%\r\nassert(isequal(primary2dec('mmmmxmmmmm'),-116))\r\n\r\n%%\r\nassert(isequal(primary2dec('ppppppppppppm'),234))\r\n\r\n%%\r\nassert(isequal(primary2dec('pppppxppppppppppppxp'),589))\r\n\r\n%%\r\nassert(isequal(primary2dec('mmmmmmmmxmmmmmmmmmmmmmmmmmmmxmmx'),-1753))\r\n\r\n%%\r\nassert(isequal(primary2dec('pppppppxpppppppppppppppppppppppppppppppppppppppxppppp'),5618))\r\n\r\n%%\r\nassert(isequal(primary2dec('mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmxmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmxmxm'),-74921))\r\n\r\n%%\r\nassert(isequal(primary2dec('ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppxpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppxpp'),514888))\r\n\r\n%%\r\nfiletext = fileread('primary2dec.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'assert') || contains(filetext,'str2num'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2025-01-06T21:00:45.000Z","deleted_by":null,"deleted_at":null,"solvers_count":10,"test_suite_updated_at":"2025-01-02T00:40:47.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2024-12-31T17:58:19.000Z","updated_at":"2026-03-16T10:13:49.000Z","published_at":"2024-12-31T17:58:24.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\u003eThe \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eprimary \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003esystem of expressing numbers has three digits: \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\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, \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\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and \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\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, which correspond to -1, 0, and 1. The places in a primary number correspond to the prime numbers. For example, the number 6 could be \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\u003eppm\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in primary notation because \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003cw:attr w:name=\\\"altTextString\\\" w:val=\\\"6 = 5*1 + 3*1 + 2*(-1)\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e6 = 5\\\\cdot 1 + 3\\\\cdot 1 + 2\\\\cdot(-1)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Similarly, the number 20 could be \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\u003eppxxp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in primary notation. \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\u003eBecause integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a number can exist. \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/60783\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 60783\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e deals with \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eproper\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e primary notation.  \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 convert integers expressed in primary notation to base 10. \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":49087,"title":"Energy Conversion 2","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 10.5px; transform-origin: 332px 10.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: 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=\"\"\u003eGiven an energy in Joule, convert it to MeV (Mega Electron Volt).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x/1e-18;\r\nend","test_suite":"%%\r\nx = 100;\r\ny_correct = 6.242e14;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 222;\r\ny_correct = 1.386e15;\r\nassert(abs(convert_stuff(x)-y_correct)\u003c1e12)\r\n","published":true,"deleted":false,"likes_count":12,"comments_count":4,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1273,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T22:12:08.000Z","updated_at":"2026-04-08T21:08:40.000Z","published_at":"2020-12-22T22:12:08.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\u003eGiven an energy in Joule, convert it to MeV (Mega Electron Volt).\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":1948,"title":"Convert this color - RGB Vector to Hex String","description":"Given a 3 element RGB vector corresponding to a color (given by the MATLAB color spec \u003chttp://www.mathworks.com/help/matlab/ref/colorspec.html\u003e), return the corresponding hex value string associated with it. This hex value string is often used when coding in HTML to specify a color. \r\n\r\nFor example, given the vector [0, 1, 1], you would return the string 00FFFF and given the vector [.5 .5 .2], you would return the string 7F7F33. We will assume that in this case once we multiply the vector by 255, we will round down to the nearest integer. If anyone thinks that we should not assume rounding down, feel free to comment :) \r\n\r\n","description_html":"\u003cp\u003eGiven a 3 element RGB vector corresponding to a color (given by the MATLAB color spec \u003ca href = \"http://www.mathworks.com/help/matlab/ref/colorspec.html\"\u003ehttp://www.mathworks.com/help/matlab/ref/colorspec.html\u003c/a\u003e), return the corresponding hex value string associated with it. This hex value string is often used when coding in HTML to specify a color.\u003c/p\u003e\u003cp\u003eFor example, given the vector [0, 1, 1], you would return the string 00FFFF and given the vector [.5 .5 .2], you would return the string 7F7F33. We will assume that in this case once we multiply the vector by 255, we will round down to the nearest integer. If anyone thinks that we should not assume rounding down, feel free to comment :)\u003c/p\u003e","function_template":"function hexString = rgb2hex(rgbColor)\r\n  hexString = rgbColor;\r\nend","test_suite":"%%\r\nx = [0,0,0.0001];\r\ny_correct = '000000';\r\nassert(isequal(rgb2hex(x),y_correct))\r\n\r\n%%\r\nx = [1,1,1];\r\ny_correct = 'FFFFFF';\r\nassert(isequal(rgb2hex(x),y_correct))\r\n\r\n%%\r\nx = [.5,.5,.2];\r\ny_correct = '7F7F33';\r\nassert(isequal(rgb2hex(x),y_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":3743,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":139,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-20T03:34:55.000Z","updated_at":"2026-02-04T11:54:49.000Z","published_at":"2013-10-20T03:34:55.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\u003eGiven a 3 element RGB vector corresponding to a color (given by the MATLAB color spec\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/matlab/ref/colorspec.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://www.mathworks.com/help/matlab/ref/colorspec.html\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e), return the corresponding hex value string associated with it. This hex value string is often used when coding in HTML to specify a color.\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\u003eFor example, given the vector [0, 1, 1], you would return the string 00FFFF and given the vector [.5 .5 .2], you would return the string 7F7F33. We will assume that in this case once we multiply the vector by 255, we will round down to the nearest integer. If anyone thinks that we should not assume rounding down, feel free to comment :)\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":49072,"title":"Area Conversion 2","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 10.5px; transform-origin: 332px 10.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: 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=\"\"\u003eGiven an area in hectares, convert it to acres.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x*713*pi;\r\nend","test_suite":"%%\r\nx = 121;\r\ny_correct = 299.0031;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 333;\r\ny_correct = 822.8763;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 1.2;\r\ny_correct = 2.9653;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":2,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":833,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:57:51.000Z","updated_at":"2026-04-08T20:56:49.000Z","published_at":"2020-12-22T21:57: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\u003eGiven an area in hectares, convert it to acres.\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":49057,"title":"Mass Conversion 1","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.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 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: 246.5px 8px; transform-origin: 246.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a mass in kg, convert it into lbs. Use a conversion factor of 2.205 lbs/kg.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x+x+x+x;\r\nend","test_suite":"%%\r\nx = 10;\r\ny_correct = 22.05;\r\nassert(abs(convert_stuff(x) - y_correct) \u003c 1e-4)\r\n%%\r\nx = 11;\r\ny_correct = 24.255;\r\nassert(abs(convert_stuff(x) - y_correct) \u003c 1e-4)\r\n%%\r\nx = -3;\r\ny_correct = 'Cannot have a negative mass';\r\nassert(isequal(convert_stuff(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":12,"comments_count":5,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1575,"test_suite_updated_at":"2021-01-11T11:36:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:45:53.000Z","updated_at":"2026-04-08T17:01:15.000Z","published_at":"2020-12-22T21:45:53.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\u003eGiven a mass in kg, convert it into lbs. Use a conversion factor of 2.205 lbs/kg.\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":49062,"title":"Mass Conversion 2","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.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 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: 246.5px 8px; transform-origin: 246.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a mass in lbs, convert it into kg. Use a conversion factor of 2.205 lbs/kg.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x/x+x*x;\r\nend","test_suite":"%%\r\nx = 22.05;\r\ny_correct = 10;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 50;\r\ny_correct = 22.6757;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 93;\r\ny_correct = 42.1769;\r\nassert(isequal(convert_stuff(x),y_correct))","published":true,"deleted":false,"likes_count":5,"comments_count":10,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":983,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:48:46.000Z","updated_at":"2026-04-08T20:45:28.000Z","published_at":"2020-12-22T21:48: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\u003eGiven a mass in lbs, convert it into kg. Use a conversion factor of 2.205 lbs/kg.\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":8046,"title":"Gold/Silver Standard","description":"Pursuant to the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard Gold Standard\u003e problem, suppose that you have data for silver rather than gold to make an assessment regarding historical currency values. Historical data for the silver-to-gold ratio is also available from \u003chttp://measuringworth.com/gold/ Measuring Worth\u003e.\r\n\r\nFor this problem, you will be provided with a historical year (HY) and a historical value (HV) in dollars. The function template includes data from the previously mentioned site for the value (in dollars) of an ounce of gold (GV), in addition to the silver-to-gold ratio, from 1791 to 2014. Write a function to determine the current value (CV) in dollars assuming that the gold standard must be converted to the silver standard to accurately convert between years. Round the result to two decimal places. If HY is outside of the historical data range, return NaN.\r\n\r\nAs an example, with HY = 2000 and HV = 1000:\r\n\r\n* GV(HY=2000) = $280.10\r\n* N = 1000/280.10 = 3.57 (ounces of gold)\r\n* SR(HY=2000) = 55.96\r\n* NS = 55.96*3.57 = 199.79 (ounces of silver)\r\n* NG = 199.79/66.38 = 3.01 (current ounces of gold) [SR(2014) = 66.38]\r\n* CV = 3.01*1270 (current $/ounce of gold) = $3822.36.","description_html":"\u003cp\u003ePursuant to the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard\"\u003eGold Standard\u003c/a\u003e problem, suppose that you have data for silver rather than gold to make an assessment regarding historical currency values. Historical data for the silver-to-gold ratio is also available from \u003ca href = \"http://measuringworth.com/gold/\"\u003eMeasuring Worth\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eFor this problem, you will be provided with a historical year (HY) and a historical value (HV) in dollars. The function template includes data from the previously mentioned site for the value (in dollars) of an ounce of gold (GV), in addition to the silver-to-gold ratio, from 1791 to 2014. Write a function to determine the current value (CV) in dollars assuming that the gold standard must be converted to the silver standard to accurately convert between years. Round the result to two decimal places. If HY is outside of the historical data range, return NaN.\u003c/p\u003e\u003cp\u003eAs an example, with HY = 2000 and HV = 1000:\u003c/p\u003e\u003cul\u003e\u003cli\u003eGV(HY=2000) = $280.10\u003c/li\u003e\u003cli\u003eN = 1000/280.10 = 3.57 (ounces of gold)\u003c/li\u003e\u003cli\u003eSR(HY=2000) = 55.96\u003c/li\u003e\u003cli\u003eNS = 55.96*3.57 = 199.79 (ounces of silver)\u003c/li\u003e\u003cli\u003eNG = 199.79/66.38 = 3.01 (current ounces of gold) [SR(2014) = 66.38]\u003c/li\u003e\u003cli\u003eCV = 3.01*1270 (current $/ounce of gold) = $3822.36.\u003c/li\u003e\u003c/ul\u003e","function_template":"function [CV] = gold_silver_standard(HY,HV)\r\n\r\nY = 1791:2014;\r\nGV = [19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 20.1, 21.64, 20.95, 19.46, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.94, 20.69, 20.69, 21.64, 20.86, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.7, 20.67, 20.67, 20.67, 20.67, 23.42, 30.02, 42.03, 32.52, 29.13, 28.57, 28.88, 27.49, 23.75, 23.09, 23.24, 23.52, 22.99, 23.75, 23.05, 21.66, 20.84, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 24.44, 34.94, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 39.26, 41.51, 36.41, 41.25, 58.6, 97.81, 159.74, 161.49, 125.32, 148.31, 193.55, 307.5, 612.56, 459.64, 375.91, 424, 360.66, 317.66, 368.24, 447.95, 438.31, 382.58, 384.93, 363.29, 344.97, 360.91, 385.42, 385.5, 389.09, 332.39, 295.24, 279.91, 280.1, 272.22, 311.33, 364.8, 410.52, 446, 606, 699, 874, 975, 1227, 1572, 1700, 1415, 1270];\r\nSR = [15.05, 15.17, 15, 15.37, 15.55, 15.65, 15.41, 15.59, 15.74, 15.68, 15.46, 15.26, 15.41, 15.41, 15.79, 15.52, 15.43, 16.08, 15.96, 15.77, 15.53, 16.11, 16.25, 15.04, 15.26, 15.28, 15.11, 15.35, 15.33, 15.62, 15.95, 15.8, 15.84, 15.82, 15.7, 15.76, 15.74, 15.78, 15.78, 15.82, 15.72, 15.73, 15.93, 15.73, 15.8, 15.72, 15.83, 15.85, 15.62, 15.62, 15.7, 15.87, 15.93, 15.85, 15.92, 15.9, 15.8, 15.85, 15.78, 15.7, 15.46, 15.59, 15.33, 15.33, 15.38, 15.38, 15.27, 15.38, 15.19, 15.29, 15.5, 15.35, 15.37, 15.37, 15.44, 15.43, 15.57, 15.59, 15.6, 15.57, 15.57, 15.63, 15.93, 16.16, 16.64, 17.75, 17.2, 17.92, 18.39, 18.05, 18.25, 18.2, 18.64, 18.61, 19.41, 20.78, 21.1, 22, 22.1, 19.75, 20.92, 23.72, 26.49, 32.56, 31.6, 30.59, 34.2, 35.03, 34.36, 33.33, 34.68, 39.15, 38.1, 35.7, 33.87, 30.54, 31.24, 38.64, 39.74, 38.22, 38.33, 33.62, 34.19, 37.37, 40.48, 30.78, 24.61, 21, 18.44, 20.28, 32.76, 30.43, 31.69, 30.8, 29.78, 33.11, 36.47, 35.34, 38.78, 53.74, 71.25, 73.29, 69.83, 72.36, 54.19, 77.09, 77.44, 80.39, 88.84, 99.76, 99.73, 90.57, 77.67, 77.67, 67.4, 43.67, 48.73, 47.07, 48.61, 47.14, 39.12, 41.16, 41.04, 41.01, 39.24, 38.5, 38.5, 39.27, 38.34, 38.27, 37.82, 32.22, 27.34, 27.04, 27.04, 27.04, 22.56, 18.29, 23.16, 20.54, 26.66, 34.75, 38.21, 33.9, 36.51, 28.76, 32.05, 35.8, 27.69, 29.66, 43.65, 47.24, 37.03, 44.26, 51.68, 67.25, 63.84, 66.95, 69.49, 79.78, 89.83, 87.47, 83.85, 72.79, 74.78, 74.89, 67.91, 53.24, 53.26, 55.96, 61.95, 67.32, 74.22, 61.3, 60.7, 52.2, 51.91, 58.17, 66.27, 60.64, 44.75, 53.58, 59.31, 66.38];\r\n\r\nCV = 1;\r\n\r\nend\r\n","test_suite":"%% current check\r\nHY = 2014; HV = 1270; CV_corr = 1270;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%% out-of-range check 1\r\nHY = 500; HV = 50; CV_corr = NaN;\r\nassert(isnan(gold_silver_standard(HY,HV)))\r\n\r\n%% out-of-range check 2\r\nHY = 2500; HV = 5000; CV_corr = NaN;\r\nassert(isnan(gold_silver_standard(HY,HV)))\r\n\r\n%%\r\nHY = 2010; HV = 1000; CV_corr = 945.54;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 2005; HV = 1000; CV_corr = 2603.88;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 2000; HV = 1000; CV_corr = 3822.36;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1995; HV = 1000; CV_corr = 3711.31;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1990; HV = 1000; CV_corr = 3965.32;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1950; HV = 1000; CV_corr = 25768.43;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1900; HV = 1000; CV_corr = 30850.44;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1850; HV = 1000; CV_corr = 14532.01;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nHY = 1800; HV = 1000; CV_corr = 15471.58;\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tHY = 2000; HV = 1000; CV_corr = 3822.36;\r\n\tcase 2\r\n\t\tHY = 1995; HV = 1000; CV_corr = 3711.31;\r\n\tcase 3\r\n\t\tHY = 2005; HV = 1000; CV_corr = 2603.88;\r\n\tcase 4\r\n\t\tHY = 1800; HV = 1000; CV_corr = 15471.58;\r\nend\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tHY = 1995; HV = 1000; CV_corr = 3711.31;\r\n\tcase 2\r\n\t\tHY = 1990; HV = 1000; CV_corr = 3965.32;\r\n\tcase 3\r\n\t\tHY = 2010; HV = 1000; CV_corr = 945.54;\r\n\tcase 4\r\n\t\tHY = 1900; HV = 1000; CV_corr = 30850.44;\r\nend\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n\r\n%%\r\nind = randi(4);\r\nswitch ind\r\n\tcase 1\r\n\t\tHY = 1990; HV = 1000; CV_corr = 3965.32;\r\n\tcase 2\r\n\t\tHY = 1950; HV = 1000; CV_corr = 25768.43;\r\n\tcase 3\r\n\t\tHY = 1900; HV = 1000; CV_corr = 30850.44;\r\n\tcase 4\r\n\t\tHY = 2000; HV = 1000; CV_corr = 3822.36;\r\nend\r\nassert(abs(gold_silver_standard(HY,HV)-CV_corr)\u003c2e-5)\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":56,"test_suite_updated_at":"2015-03-30T16:51:28.000Z","rescore_all_solutions":false,"group_id":30,"created_at":"2015-03-30T16:22:04.000Z","updated_at":"2026-03-27T06:19:08.000Z","published_at":"2015-03-30T16:22:04.000Z","restored_at":"2017-07-28T15:24:51.000Z","restored_by":null,"spam":false,"simulink":false,"admin_reviewed":true,"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\u003ePursuant to the\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/8045-gold-standard\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGold Standard\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e problem, suppose that you have data for silver rather than gold to make an assessment regarding historical currency values. Historical data for the silver-to-gold ratio is also available from\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://measuringworth.com/gold/\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMeasuring Worth\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\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor this problem, you will be provided with a historical year (HY) and a historical value (HV) in dollars. The function template includes data from the previously mentioned site for the value (in dollars) of an ounce of gold (GV), in addition to the silver-to-gold ratio, from 1791 to 2014. Write a function to determine the current value (CV) in dollars assuming that the gold standard must be converted to the silver standard to accurately convert between years. Round the result to two decimal places. If HY is outside of the historical data range, return NaN.\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\u003eAs an example, with HY = 2000 and HV = 1000:\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\u003eGV(HY=2000) = $280.10\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\u003eN = 1000/280.10 = 3.57 (ounces of gold)\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\u003eSR(HY=2000) = 55.96\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\u003eNS = 55.96*3.57 = 199.79 (ounces of silver)\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\u003eNG = 199.79/66.38 = 3.01 (current ounces of gold) [SR(2014) = 66.38]\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\u003eCV = 3.01*1270 (current $/ounce of gold) = $3822.36.\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":2283,"title":"Convert a number to its Roman representation","description":"Convert a given number to its Roman representation.\r\n\r\nFor example, if the number is 98, it should display 'XCVIII'","description_html":"\u003cp\u003eConvert a given number to its Roman representation.\u003c/p\u003e\u003cp\u003eFor example, if the number is 98, it should display 'XCVIII'\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 'I';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 98;\r\ny_correct = 'XCVIII';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 501;\r\ny_correct = 'DI';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 867;\r\ny_correct = 'DCCCLXVII';\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":22816,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":35,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-04-14T05:55:54.000Z","updated_at":"2025-12-07T23:09:08.000Z","published_at":"2014-04-14T05:55:57.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 a given number to its Roman representation.\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\u003eFor example, if the number is 98, it should display 'XCVIII'\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":42849,"title":"RGB to CMYK","description":"Convert an RGB code to the corresponding CMYK code for printing.\r\n\r\n\r\nThe RGB input is a [1×3] double array between 0 and 1.\r\n\r\nCMYK must be a [1×4] double array between 0 and 1.","description_html":"\u003cp\u003eConvert an RGB code to the corresponding CMYK code for printing.\u003c/p\u003e\u003cp\u003eThe RGB input is a [1×3] double array between 0 and 1.\u003c/p\u003e\u003cp\u003eCMYK must be a [1×4] double array between 0 and 1.\u003c/p\u003e","function_template":"function CMYK = rgb2cmyk(RGB)\r\n  CMYK = RGB;\r\nend","test_suite":"%%\r\nRGB   = [0,0,0];\r\nCMYK  = [0,0,0,1];\r\nassert(isequal(rgb2cmyk(RGB),CMYK))\r\n%%\r\nRGB   = [1,1,1];\r\nCMYK  = [0,0,0,0];\r\nassert(isequal(rgb2cmyk(RGB),CMYK))\r\n%%\r\nRGB   = [1,0,0];\r\nCMYK  = [0,1,1,0];\r\nassert(isequal(rgb2cmyk(RGB),CMYK))\r\n%%\r\nRGB   = [1,1,0];\r\nCMYK  = [0,0,1,0];\r\nassert(isequal(rgb2cmyk(RGB),CMYK))\r\n%%\r\nRGB   = [150,25,0]/255;\r\nCMYK  = [0,5/6,1,7/17];\r\nerror = abs(rgb2cmyk(RGB)-CMYK);\r\nassert(all(error\u003c1e-4))","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":12767,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":133,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-05-05T15:25:57.000Z","updated_at":"2026-02-03T09:25:44.000Z","published_at":"2016-05-05T15:26:16.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 an RGB code to the corresponding CMYK code for printing.\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\u003eThe RGB input is a [1×3] double array between 0 and 1.\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\u003eCMYK must be a [1×4] double array between 0 and 1.\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":49067,"title":"Area Conversion 1","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 332px 10.5px; transform-origin: 332px 10.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: 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=\"\"\u003eGiven an area in ft^2, convert it to m^2.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = convert_stuff(x)\r\n  y = x+area*2;\r\nend","test_suite":"%%\r\nx = 11;\r\ny_correct = 1.0219;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 336;\r\ny_correct = 31.2144;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 121;\r\ny_correct = 11.2409;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n%%\r\nx = 12.5;\r\ny_correct = 1.1613;\r\nassert(isequal(convert_stuff(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":11,"created_by":180632,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1026,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-12-22T21:53:28.000Z","updated_at":"2026-04-08T20:52:09.000Z","published_at":"2020-12-22T21:53:28.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\u003eGiven an area in ft^2, convert it to m^2.\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":8047,"title":"Weighted Gold/Silver Standard","description":"Building off of the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard Gold Standard\u003e and \u003chttp://www.mathworks.com/matlabcentral/cody/problems/8046-gold-silver-standard Gold/Silver Standard\u003e problems, let's make a weighted currency convertor. The same data for gold value and silver-to-gold ratio will be provided in the function template.\r\n\r\nFor this problem, based on a historical year (HY) and a historical value (HV) in dollars, calculate the current value using the gold (CVG) and silver (CVS) references; see the referenced problems for details and examples of those individual problems. In this case, you will be provided a weighting that will range from 0 to 1, where 0 indicates complete weighting by gold and 1 indicates complete weighting by silver. Remember to round the result to two decimal places. If HY is outside of the historical data range, return NaN.\r\n\r\nAs an example, with HY = 2000, HV = 1000, and wt = 0.4:\r\n\r\n* CVG = $4534.09 (gold standard)\r\n* CVS = $3822.36 (silver standard)\r\n* CV = (1-0.4)*4534.09 + 0.4*3822.36 = $4249.40.","description_html":"\u003cp\u003eBuilding off of the \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8045-gold-standard\"\u003eGold Standard\u003c/a\u003e and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/8046-gold-silver-standard\"\u003eGold/Silver Standard\u003c/a\u003e problems, let's make a weighted currency convertor. The same data for gold value and silver-to-gold ratio will be provided in the function template.\u003c/p\u003e\u003cp\u003eFor this problem, based on a historical year (HY) and a historical value (HV) in dollars, calculate the current value using the gold (CVG) and silver (CVS) references; see the referenced problems for details and examples of those individual problems. In this case, you will be provided a weighting that will range from 0 to 1, where 0 indicates complete weighting by gold and 1 indicates complete weighting by silver. Remember to round the result to two decimal places. If HY is outside of the historical data range, return NaN.\u003c/p\u003e\u003cp\u003eAs an example, with HY = 2000, HV = 1000, and wt = 0.4:\u003c/p\u003e\u003cul\u003e\u003cli\u003eCVG = $4534.09 (gold standard)\u003c/li\u003e\u003cli\u003eCVS = $3822.36 (silver standard)\u003c/li\u003e\u003cli\u003eCV = (1-0.4)*4534.09 + 0.4*3822.36 = $4249.40.\u003c/li\u003e\u003c/ul\u003e","function_template":"function [CV] = gold_silver_weighted_standard(HY,HV,wt)\r\n\r\nY = 1791:2014;\r\nGV = [19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 20.1, 21.64, 20.95, 19.46, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.39, 19.94, 20.69, 20.69, 21.64, 20.86, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.7, 20.67, 20.67, 20.67, 20.67, 23.42, 30.02, 42.03, 32.52, 29.13, 28.57, 28.88, 27.49, 23.75, 23.09, 23.24, 23.52, 22.99, 23.75, 23.05, 21.66, 20.84, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 20.67, 24.44, 34.94, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 39.26, 41.51, 36.41, 41.25, 58.6, 97.81, 159.74, 161.49, 125.32, 148.31, 193.55, 307.5, 612.56, 459.64, 375.91, 424, 360.66, 317.66, 368.24, 447.95, 438.31, 382.58, 384.93, 363.29, 344.97, 360.91, 385.42, 385.5, 389.09, 332.39, 295.24, 279.91, 280.1, 272.22, 311.33, 364.8, 410.52, 446, 606, 699, 874, 975, 1227, 1572, 1700, 1415, 1270];\r\nSR = [15.05, 15.17, 15, 15.37, 15.55, 15.65, 15.41, 15.59, 15.74, 15.68, 15.46, 15.26, 15.41, 15.41, 15.79, 15.52, 15.43, 16.08, 15.96, 15.77, 15.53, 16.11, 16.25, 15.04, 15.26, 15.28, 15.11, 15.35, 15.33, 15.62, 15.95, 15.8, 15.84, 15.82, 15.7, 15.76, 15.74, 15.78, 15.78, 15.82, 15.72, 15.73, 15.93, 15.73, 15.8, 15.72, 15.83, 15.85, 15.62, 15.62, 15.7, 15.87, 15.93, 15.85, 15.92, 15.9, 15.8, 15.85, 15.78, 15.7, 15.46, 15.59, 15.33, 15.33, 15.38, 15.38, 15.27, 15.38, 15.19, 15.29, 15.5, 15.35, 15.37, 15.37, 15.44, 15.43, 15.57, 15.59, 15.6, 15.57, 15.57, 15.63, 15.93, 16.16, 16.64, 17.75, 17.2, 17.92, 18.39, 18.05, 18.25, 18.2, 18.64, 18.61, 19.41, 20.78, 21.1, 22, 22.1, 19.75, 20.92, 23.72, 26.49, 32.56, 31.6, 30.59, 34.2, 35.03, 34.36, 33.33, 34.68, 39.15, 38.1, 35.7, 33.87, 30.54, 31.24, 38.64, 39.74, 38.22, 38.33, 33.62, 34.19, 37.37, 40.48, 30.78, 24.61, 21, 18.44, 20.28, 32.76, 30.43, 31.69, 30.8, 29.78, 33.11, 36.47, 35.34, 38.78, 53.74, 71.25, 73.29, 69.83, 72.36, 54.19, 77.09, 77.44, 80.39, 88.84, 99.76, 99.73, 90.57, 77.67, 77.67, 67.4, 43.67, 48.73, 47.07, 48.61, 47.14, 39.12, 41.16, 41.04, 41.01, 39.24, 38.5, 38.5, 39.27, 38.34, 38.27, 37.82, 32.22, 27.34, 27.04, 27.04, 27.04, 22.56, 18.29, 23.16, 20.54, 26.66, 34.75, 38.21, 33.9, 36.51, 28.76, 32.05, 35.8, 27.69, 29.66, 43.65, 47.24, 37.03, 44.26, 51.68, 67.25, 63.84, 66.95, 69.49, 79.78, 89.83, 87.47, 83.85, 72.79, 74.78, 74.89, 67.91, 53.24, 53.26, 55.96, 61.95, 67.32, 74.22, 61.3, 60.7, 52.2, 51.91, 58.17, 66.27, 60.64, 44.75, 53.58, 59.31, 66.38];\r\n\r\nCV = 1;\r\n\r\nend\r\n","test_suite":"%% current check\r\nHY = 2014; HV = 1270; wt = 0.5; CV_corr = 1270;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%% out-of-range check 1\r\nHY = 500; HV = 50; wt = 0.5; CV_corr = NaN;\r\nassert(isnan(gold_silver_weighted_standard(HY,HV,wt)))\r\n\r\n%% out-of-range check 2\r\nHY = 2500; HV = 5000; wt = 0.5; CV_corr = NaN;\r\nassert(isnan(gold_silver_weighted_standard(HY,HV,wt)))\r\n\r\n%%\r\nHY = 2010; HV = 1000; wt = 0.5; CV_corr = 990.29;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 2005; HV = 1000; wt = 0.5; CV_corr = 2725.7;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 2000; HV = 1000; wt = 0.5; CV_corr = 4178.23;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1995; HV = 1000; wt = 0.5; CV_corr = 3502.87;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1990; HV = 1000; wt = 0.5; CV_corr = 3632.31;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1950; HV = 1000; wt = 0.5; CV_corr = 31027.07;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1900; HV = 1000; wt = 0.5; CV_corr = 46146.07;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1850; HV = 1000; wt = 0.5; CV_corr = 37986.86;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1800; HV = 1000; wt = 0.5; CV_corr = 40484.63;\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 2000; HV = 1000;\r\nwt = randi(10)/10;\r\nswitch (wt*10)\r\n\tcase 0\r\n\t\tCV_corr = 4534.09;\r\n\tcase 1\r\n\t\tCV_corr = 4462.92;\r\n\tcase 2\r\n\t\tCV_corr = 4391.75;\r\n\tcase 3\r\n\t\tCV_corr = 4320.57;\r\n\tcase 4\r\n\t\tCV_corr = 4249.4;\r\n\tcase 5\r\n\t\tCV_corr = 4178.23;\r\n\tcase 6\r\n\t\tCV_corr = 4107.05;\r\n\tcase 7\r\n\t\tCV_corr = 4035.88;\r\n\tcase 8\r\n\t\tCV_corr = 3964.7;\r\n\tcase 9\r\n\t\tCV_corr = 3893.53;\r\n\tcase 10\r\n\t\tCV_corr = 3822.36;\r\nend\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n\r\n%%\r\nHY = 1800; HV = 1000;\r\nwt = randi(10)/10;\r\nswitch (wt*10)\r\n\tcase 0\r\n\t\tCV_corr = 65497.68;\r\n\tcase 1\r\n\t\tCV_corr = 60495.07;\r\n\tcase 2\r\n\t\tCV_corr = 55492.46;\r\n\tcase 3\r\n\t\tCV_corr = 50489.85;\r\n\tcase 4\r\n\t\tCV_corr = 45487.24;\r\n\tcase 5\r\n\t\tCV_corr = 40484.63;\r\n\tcase 6\r\n\t\tCV_corr = 35482.02;\r\n\tcase 7\r\n\t\tCV_corr = 30479.41;\r\n\tcase 8\r\n\t\tCV_corr = 25476.8;\r\n\tcase 9\r\n\t\tCV_corr = 20474.19;\r\n\tcase 10\r\n\t\tCV_corr = 15471.58;\r\nend\r\nassert(abs(gold_silver_weighted_standard(HY,HV,wt)-CV_corr)\u003c5e-2)\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":50,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":30,"created_at":"2015-03-30T16:47:31.000Z","updated_at":"2026-03-27T06:22:48.000Z","published_at":"2015-03-30T16:47:31.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\u003eBuilding off of the\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/8045-gold-standard\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGold Standard\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e 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=\\\"http://www.mathworks.com/matlabcentral/cody/problems/8046-gold-silver-standard\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGold/Silver Standard\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e problems, let's make a weighted currency convertor. The same data for gold value and silver-to-gold ratio will be provided in the function template.\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\u003eFor this problem, based on a historical year (HY) and a historical value (HV) in dollars, calculate the current value using the gold (CVG) and silver (CVS) references; see the referenced problems for details and examples of those individual problems. In this case, you will be provided a weighting that will range from 0 to 1, where 0 indicates complete weighting by gold and 1 indicates complete weighting by silver. Remember to round the result to two decimal places. If HY is outside of the historical data range, return NaN.\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\u003eAs an example, with HY = 2000, HV = 1000, and wt = 0.4:\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\u003eCVG = $4534.09 (gold standard)\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\u003eCVS = $3822.36 (silver standard)\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\u003eCV = (1-0.4)*4534.09 + 0.4*3822.36 = $4249.40.\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":49835,"title":"Decimal to Binary conversion for Large Integers","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: 436.9px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 218.45px; transform-origin: 407px 218.45px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 41.6px; 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=\"\"\u003eDecimal integer, a base-10 number we normally use without fractional component, can be represented as \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Binary_number\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ebinary\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, a base-2 number composed either 0 or 1. The procedure to convert a decimal integer X to its binary equivalent is as follows:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003col style=\"block-size: 60px; font-family: Helvetica, Arial, sans-serif; list-style-type: decimal; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 30px; transform-origin: 391px 30px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eDivide X by 2. The remainder (either 0 or 1) is the first binary value.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eDivide the quotient of previous step by 2. The remainder is the next binary value.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eRepeat the process until the quotient cannot be divided anymore and so last binary is found.\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e\u003cdiv style=\"block-size: 22.1px; 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 11.05px; text-align: left; transform-origin: 384px 11.05px; 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=\"\"\u003eAs example, \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARsAAAAnCAYAAAA/4uxDAAAJqklEQVR4Xu2dd8gtRxmHn9gL9o5dDFFsiKCiotjRP+zGLooVe8PeEiti19i7JhoTOyoqIvbeUBFRULF37FgTnss7l7mb3XNmd+493zfnzEBIyE55z292fvvW+Y6it45AR6AjsAEEjtrAGn2JjkBHoCNAJ5v+EnQEOgIbQaCTzUZg7ot0BDoCnWz6O9AR6AhsBIFONhuBuS/SEegI7BXZuO51gd8DP+zb0BHoCGw/AqvI5kzAdYD7ATcDLgt8GjgVeDvw5zXwXBR4PXCbiX5vAR4G/D2enx14AfCIQtgfA7yksO82d7sM8HDgG8A7C36oON8auC3wM+AScCBQ8Dbgs8D/V8xRMzafdpMyt7hu6zKPvkJTZHNO4LHA44EfAb8LsjkmZvkw8GDg5ytezDsA71nx/I7Ae7PnVwFOAa5ccGB+BdwO+EpB323t4oF9CPAA4ILAPYET1/xYPxgS9NmAhwI/jf7XA94AvA94bvYByKerGZvm2bTMLa7bsswrX78xsvH/qV2o1TwV+DFwGqCmcyvghCCeZwHHAf8bWeECwGuB78TXctjlb/HsX/HANR8N3BJ4DvC9Cakv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WcN4f/73q2sk0XW5CrXJojh3kJWSTKozHtJ4aMjkSY9UQdcKJi05c98smQehrsbbJSvupqnivAHGs/1j2oUZqyrtj1WYPCVcOfsDSsXslc4vrtihzek0sJ1Ix+M/IBWyLQ99H4hAdrjk3YUYdLln7PB2BbULACgE/Yp7BM5QxLXEQ73dwpsgmRdDUsrbFQbzf96LLtzsIWEepKe8Fd8OrZybNqNbhmRv6lnCfEc7rfgNg67vf5d8LBPTJevuj+TaTgZ9d0mz8rYbrzQ3I82m8jjQVk47dzbsXm9fX7Ai0goCRSoM+5tt8NxNa/425a+bjHdB0to1skpaipuLFXVPlCv71BvsYlbG84fnxJ1F0kPbWEegIlCFgwMC/9eY1FwaC8nbFyPg3In2gnnGbyMakNKM0+mPMf3lT5AMZzs3vVTGxUNtS1U/GdZzh4C8XXs5etg29V0dguxEwamYejWQy1s7wt922iWy2e2v7r+sINI5AJ5vGN7CL3xFoBYFONq3sVJezI9A4Ap1sGt/ALn5HoBUEOtm0slNdzo5A4wh0sml8A7v4HYFWEDgdiAl0ZCqegPsAAAAASUVORK5CYII=\" width=\"141.5\" height=\"19.5\" style=\"width: 141.5px; height: 19.5px;\"\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 through process below:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 223.6px; 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 111.8px; text-align: left; transform-origin: 384px 111.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=\"\"\u003e        \u003c/span\u003e\u003c/span\u003e\u003cimg class=\"imageNode\" width=\"60\" height=\"218\" style=\"vertical-align: baseline;width: 60px;height: 218px\" src=\"https://upload.wikimedia.org/wikipedia/commons/d/d0/Decimal_to_Binary_Conversion.gif\" data-image-state=\"image-loaded\"\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 41.6px; 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=\"\"\u003eGiven a decimal string input x, build a function dectobin(x) that returns its binary equivalent in character array. Unlike built-in dec2bin function, your function should also work for large integers up to thousands number of digits.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = dectobin(x)\r\n  y = x;\r\nend","test_suite":"clear\r\n%%\r\nbannedWords = {'regexp','regexpi','import','java'};\r\nassessFunctionAbsence(bannedWords,'Filename','dectobin.m')\r\n\r\n%%\r\nx = '0';\r\ny_correct = x;\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\nx = '1';\r\ny_correct = x;\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\nx = '13';\r\ny_correct = dec2bin(str2num(x));\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\nx = '1234';\r\ny_correct = dec2bin(str2num(x));\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\nx = '123456789';\r\ny_correct = dec2bin(str2num(x));\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\nx = num2str(randi([1e6 1e9])); % 7-10 digits\r\ny_correct = dec2bin(str2num(x));\r\nassert(isequal(dectobin(x),y_correct))\r\n \r\n%%\r\nx = num2str(int64(randi([1e14 1e15]))); % 15-16 digits\r\ny_correct = dec2bin(str2num(x));\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\n% 100 digits\r\nx = '9935889422099775700620749019825066687005320193436482650621467845674334663581207733950858713953594810';\r\ny_correct = '100100010101110101001011011110111011001010010010000001101010001111010001111000110111110100011000000010001001010111101101111101000101110000110110100100001101001010010001010000010011111111010100111111100110010011111001110111001111011111000010011101111100000000100000001011011000001010111001110001010101001101110011111011110110110111010';\r\nassert(isequal(dectobin(x),y_correct))\r\n\r\n%%\r\n% 1,000 digits\r\nx = '3059201154261253530451690354977606310924322607284223918856338124374709270871880662494169428937121052075859797206813475095556104269276596500978875324047465920883111580522711413182514848655486194576723389296141674672149809829265420167820519225209898307641365760914568721866463844355172261421834003336488535238809007328873935253700111210006241805977393874531741494641320187019834745948717074377488851592337628009671305943507313220241345532153678625541382153876303729081245594666363375641541440039672508266173273547591929050186861649876277730738299377510850280883881669370053397327830542446255453962902873897458955875563317360197974644289445704776742967853660702740237720951325610419441880361333911947025395121778148262639261460523590232675016389707381618111484504793129877986986813532838182033892534760974140550358778239119177192242757139854881677013489678325929427533280319023842380171528893573940130880205407716783800858180602225696643483888830206964236483084265907918866516345819848257322544972900223';\r\ny_correct = '100101010000010000001101010010100110001010110110111010110011000100110001100101100011010101101110000011101111100011011101110100000001001001011110000111111011111011111000010010000010011011110011111010101100001111001111111100010001100110011101011011100101001001011100111000011000111100110110110100001000110101011010001110110111010010001111111101100110111110110100101010000110100010110101110011100111100011100000101001001011110010010000110011001011111101100001001110010001111011011100001101100111000011001000101100000110011101000010001011110101110111010001110111011111000010100000010010000001001010001010110101010111100101100111010110011101001000111001001101100110010111011001010011010100011100010100111010110111011111111101010111011000000010111010110100001010001000110010011011000110111011110011101010100101101100000101010000101001000000000010010110000110100111111000111110001011001111110010001011011100011110011001110001101110010010101100101110100110100101000110001010110011000010011110101111110100010100011001101010101101110100001010000100001011010110110000111011001000001101111110011111000100001100000011101010011011000010111110100111100111010101001001001111001011000100001110101110001001110110010010101001000111001010100101110000110111001110001110111100110110101011010000001110110011010011011101100100000101111100001010010100000000001111101001011111110001100001001110101101111101101110111100001000001111101111111100100010111000011111001110011101001001110111001001111011000110000101100101000101100001001101000110000011010001111001110000100001011110111011011111111110000000011110101111101001100101010101111111011010001100100100001110000010110110100101100111111100100011101000111010100001001111110010101101100101010101011100000101101001110000010001011010110101100000011010100111010001111100100001001101000010011100110000010111111010000110010100000110101010000000001010000011011011101001010111010100111100011100011101101111010010110111001000111001001010000111100001110111110110000000001100011100010111110100010000110111110111110000001010000011010001001000011100011011010110010000010101011100100010110101000111110111101111110101011001101001000011110010101011000000000010110010000110010011100101000101101001111011010010101100110011011110101111111001010000100011111000100000010000101110100110100000111111011111011111011010110100000100100010011001010111101110010011011001010000111011111011100101111000100000100101010110000110000000001000100110100000111101111000011111110010101011101101100110111001011110101110000010000101110010100101000101111100110011111111111001001011101010111001001100110010101011101000101011110100100001111001111101110101100011110100001010110101110100011110001101001101011010110011101101011111101001010010110101001011001011001101110010100001001100101110001101100110010010010011111010011111110110000100010101011101001110000010010010110001100011100100011010011011010111010110100110011101000000101010101100110101000111111010000110011010000001111001111101000010111010111101100100111100001010001010110010100001010010010110110100101000001001101010101101100111011111101000110100000100110111010100111101011100111001111110001101111001111010101111111100101000111010101101011110010010001110001111111011000001001001000101010001000111101001011011001010010011011001010110110000011000001100110010011111011110010011101111111';\r\nassert(isequal(dectobin(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":392030,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":5,"test_suite_updated_at":"2021-01-17T04:22:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2021-01-16T07:49:57.000Z","updated_at":"2025-11-19T01:41:17.000Z","published_at":"2021-01-16T08:14:40.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\u003eDecimal integer, a base-10 number we normally use without fractional component, can be represented as \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Binary_number\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ebinary\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, a base-2 number composed either 0 or 1. The procedure to convert a decimal integer X to its binary equivalent is as follows:\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=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivide X by 2. The remainder (either 0 or 1) is the first binary value.\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=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDivide the quotient of previous step by 2. The remainder is the next binary value.\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=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eRepeat the process until the quotient cannot be divided anymore and so last binary is found.\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\u003eAs example, \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e357_{10} \\\\equiv 10010101101_2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e through process 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=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e        \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"image\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"height\\\" w:val=\\\"218\\\"/\u003e\u003cw:attr w:name=\\\"width\\\" w:val=\\\"60\\\"/\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\u003eGiven a decimal string input x, build a function dectobin(x) that returns its binary equivalent in character array. Unlike built-in dec2bin function, your function should also work for large integers up to thousands number of digits.\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.gif\",\"relationshipId\":\"rId1\"}]},{\"partUri\":\"/media/image1.gif\",\"contentType\":\"image/gif\",\"content\":\"https://upload.wikimedia.org/wikipedia/commons/d/d0/Decimal_to_Binary_Conversion.gif\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2413,"title":"Temperature Conversion Utility","description":"There are a few problems on Cody regarding temperature conversion (C to K, C to F, F to C), but none include Rankine. Furthermore, they each involve simple one-liner solutions. For this problem, you are to write a utility function that takes a given temperature and two capital letters designating which temperature scale is being converted to which. For example, T_convertor(100,'C','F') requires 100 degrees Celsius be converted to Fahrenheit.\r\n\r\nThe test suite includes all 16 possible combinations: C to F, C to R, C to C, C to K, K to F, K to R, etc. (Yes, the redundant combinations are included.)\r\n\r\nFor reference, temperature conversion formulas are available at \u003chttp://en.wikipedia.org/wiki/Temperature_conversion\u003e.\r\n\r\nA follow-on problem (more difficult with string inputs) is located here: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/2415-temperature-conversion-utility-strings\u003e.","description_html":"\u003cp\u003eThere are a few problems on Cody regarding temperature conversion (C to K, C to F, F to C), but none include Rankine. Furthermore, they each involve simple one-liner solutions. For this problem, you are to write a utility function that takes a given temperature and two capital letters designating which temperature scale is being converted to which. For example, T_convertor(100,'C','F') requires 100 degrees Celsius be converted to Fahrenheit.\u003c/p\u003e\u003cp\u003eThe test suite includes all 16 possible combinations: C to F, C to R, C to C, C to K, K to F, K to R, etc. (Yes, the redundant combinations are included.)\u003c/p\u003e\u003cp\u003eFor reference, temperature conversion formulas are available at \u003ca href = \"http://en.wikipedia.org/wiki/Temperature_conversion\"\u003ehttp://en.wikipedia.org/wiki/Temperature_conversion\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eA follow-on problem (more difficult with string inputs) is located here: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2415-temperature-conversion-utility-strings\"\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/2415-temperature-conversion-utility-strings\u003c/a\u003e.\u003c/p\u003e","function_template":"function T_out = T_convertor(T,u1,u2)\r\n T_out = T;\r\nend","test_suite":"%%\r\nT = 100;\r\nu1 = 'C';\r\nu2 = 'F';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-212) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'C';\r\nu2 = 'R';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-671.67) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'C';\r\nu2 = 'C';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-100) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'C';\r\nu2 = 'K';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-373.15) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'K';\r\nu2 = 'F';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-(-279.67)) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'K';\r\nu2 = 'R';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-180) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'K';\r\nu2 = 'C';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-(-173.15)) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'K';\r\nu2 = 'K';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-100) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'F';\r\nu2 = 'F';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-100) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'F';\r\nu2 = 'R';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-559.67) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'F';\r\nu2 = 'C';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-37.7777778) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'F';\r\nu2 = 'K';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-310.9277778) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'R';\r\nu2 = 'F';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-(-359.67)) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'R';\r\nu2 = 'R';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-100) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'R';\r\nu2 = 'C';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-(-217.5944444)) \u003c eps)\r\n\r\n%%\r\nT = 100;\r\nu1 = 'R';\r\nu2 = 'K';\r\neps = 1e-4;\r\nassert(abs(T_convertor(T,u1,u2)-55.5555556) \u003c eps)\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":50,"test_suite_updated_at":"2014-07-11T12:34:03.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-11T12:30:22.000Z","updated_at":"2026-04-03T03:09:06.000Z","published_at":"2014-07-11T12:34:03.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\u003eThere are a few problems on Cody regarding temperature conversion (C to K, C to F, F to C), but none include Rankine. Furthermore, they each involve simple one-liner solutions. For this problem, you are to write a utility function that takes a given temperature and two capital letters designating which temperature scale is being converted to which. For example, T_convertor(100,'C','F') requires 100 degrees Celsius be converted to Fahrenheit.\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 test suite includes all 16 possible combinations: C to F, C to R, C to C, C to K, K to F, K to R, etc. (Yes, the redundant combinations are included.)\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\u003eFor reference, temperature conversion formulas are available at\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://en.wikipedia.org/wiki/Temperature_conversion\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://en.wikipedia.org/wiki/Temperature_conversion\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\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA follow-on problem (more difficult with string inputs) is located here:\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/2415-temperature-conversion-utility-strings\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/2415-temperature-conversion-utility-strings\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":1378,"title":"Young's modulus","description":"Given a value of \u003chttp://en.wikipedia.org/wiki/Young_modulus Young's modulus\u003e (Y) expressed on MegaPascal, convert it to the units described on the string S.\r\n\r\nExample:\r\n\r\n Y = 200000 (MPa)\r\n S = kN/m^2\r\n\r\nreturn:\r\n\r\n y = 200000000","description_html":"\u003cp\u003eGiven a value of \u003ca href = \"http://en.wikipedia.org/wiki/Young_modulus\"\u003eYoung's modulus\u003c/a\u003e (Y) expressed on MegaPascal, convert it to the units described on the string S.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e Y = 200000 (MPa)\r\n S = kN/m^2\u003c/pre\u003e\u003cp\u003ereturn:\u003c/p\u003e\u003cpre\u003e y = 200000000\u003c/pre\u003e","function_template":"function y = convert_young(Y,S)\r\n  y = Y;\r\nend","test_suite":"%%\r\nY = 2e5;\r\nS = 'kN/m^2';\r\ny_correct = 2e8;\r\nassert(isequal(convert_young(Y,S),y_correct))\r\n\r\n\r\n%%\r\nY = 2e5;\r\nS = 'N/m^2';\r\ny_correct = 2e11;\r\nassert(isequal(convert_young(Y,S),y_correct))\r\n\r\n\r\n%%\r\nY = 2e5;\r\nS = 'kN/mm^2';\r\ny_correct = 2e2;\r\nassert(isequal(convert_young(Y,S),y_correct))\r\n\r\n\r\n%%\r\nY = 2e5;\r\nS = 'N/mm^2';\r\ny_correct = 2e5;\r\nassert(isequal(convert_young(Y,S),y_correct))\r\n\r\n\r\n%%\r\nY = 2e5;\r\nS = 'kN/cm^2';\r\ny_correct = 2e4;\r\nassert(isequal(convert_young(Y,S),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":3919,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":86,"test_suite_updated_at":"2013-03-25T14:30:46.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-03-23T18:30:14.000Z","updated_at":"2025-12-02T10:12:33.000Z","published_at":"2013-03-23T18:30: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\u003eGiven a value of\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://en.wikipedia.org/wiki/Young_modulus\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eYoung's modulus\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (Y) expressed on MegaPascal, convert it to the units described on the string S.\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\u003eExample:\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[ Y = 200000 (MPa)\\n S = kN/m^2]]\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\u003ereturn:\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[ y = 200000000]]\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":2046,"title":"Convert binary numbers to hexadecimal numbers","description":"Function must convert the input vector x composed of 0 and 1 (length is a multiple of 8) in hexadecimal. Most significant bit is first. each pair of hexadecimal symbols must be separated by space.\r\n\r\n*Example*:\r\n[1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1] will return 'F0 E1'","description_html":"\u003cp\u003eFunction must convert the input vector x composed of 0 and 1 (length is a multiple of 8) in hexadecimal. Most significant bit is first. each pair of hexadecimal symbols must be separated by space.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e:\r\n[1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1] will return 'F0 E1'\u003c/p\u003e","function_template":"function y = bin2hex(x)\r\n  y = 'AB CD';\r\nend","test_suite":"%%\r\nx = [1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1] ;\r\ny_correct = 'F0 E1';\r\nassert(isequal(bin2hex(x),y_correct));\r\n\r\n%%\r\nx = ones(1,80);\r\ny_correct = 'FF FF FF FF FF FF FF FF FF FF';\r\nassert(isequal(bin2hex(x),y_correct));\r\n\r\n%%\r\nx = zeros(1,8);\r\ny_correct = '00';\r\nassert(isequal(bin2hex(x),y_correct));\r\n\r\n%%\r\nx = '1 0 0 1 1 1 1 0 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 0 1 0 0 1 1 0 1 0';\r\ny_correct = '9E 6B E2 9A';\r\nassert(isequal(bin2hex(x),y_correct));","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":19725,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":46,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-12-13T15:48:33.000Z","updated_at":"2026-01-06T20:29:31.000Z","published_at":"2013-12-13T15:51:02.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\u003eFunction must convert the input vector x composed of 0 and 1 (length is a multiple of 8) in hexadecimal. Most significant bit is first. each pair of hexadecimal symbols must be separated by space.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: [1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1] will return 'F0 E1'\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":394,"title":"Convert String to Morse Code","description":"Convert a given string to international \u003chttp://en.wikipedia.org/wiki/Morse_code Morse Code\u003e\r\n\r\n* Strings will only have [A-z], [0-9] and space characters\r\n* A string must be returned with dots (.), dashes (-) and spaces between words\r\n\r\nFor example:\r\ngiven |str = 'MATLAB is good'| return |ystr = '--.--.-...--... ..... --.-------..'|\r\n","description_html":"\u003cp\u003eConvert a given string to international \u003ca href=\"http://en.wikipedia.org/wiki/Morse_code\"\u003eMorse Code\u003c/a\u003e\u003c/p\u003e\u003cul\u003e\u003cli\u003eStrings will only have [A-z], [0-9] and space characters\u003c/li\u003e\u003cli\u003eA string must be returned with dots (.), dashes (-) and spaces between words\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eFor example:\r\ngiven \u003ctt\u003estr = 'MATLAB is good'\u003c/tt\u003e return \u003ctt\u003eystr = '--.--.-...--... ..... --.-------..'\u003c/tt\u003e\u003c/p\u003e","function_template":"function ystr = morseCoder(str)\r\n  n = {'-----' '.----' '..---' '...--' '....-' '.....' '-....'...\r\n       '--...' '---..' '----.'};\r\n  c = {'.-' '-...' '-.-.' '-..' '.' '..-.' '--.' '....' '..'...\r\n       '.---' '-.-' '.-..' '--' '-.' '---' '.--.' '--.-' '.-.' '...'...\r\n       '-' '..-' '...-' '.--' '-..-' '-.--' '--..'};\r\n  ystr = str;\r\nend","test_suite":"%%\r\nx = 'MATLAB is good';\r\ny_correct = '--.--.-...--... ..... --.-------..';\r\nassert(isequal(morseCoder(x),y_correct))\r\n%%\r\nx = 'The quick brown fox jumps over the lazy dog';\r\ny_correct = '-..... --.-..-..-.-.-.- -....-.---.---. ..-.----..- .---..---.--.... ---...-..-. -..... .-...---..-.-- -..-----.';\r\nassert(isequal(morseCoder(x),y_correct))\r\n%%\r\nx = '01234567890 is a pallindrome';\r\ny_correct = '-----.----..---...--....-.....-....--...---..----.----- ..... .- .--..-.-...-....-.-...-.-----.';\r\nassert(isequal(morseCoder(x),y_correct))","published":true,"deleted":false,"likes_count":4,"comments_count":1,"created_by":1597,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":219,"test_suite_updated_at":"2012-02-24T02:55:18.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-02-24T02:55:18.000Z","updated_at":"2026-03-14T05:17:37.000Z","published_at":"2012-02-24T02:56: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\",\"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\u003eConvert a given string to international\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://en.wikipedia.org/wiki/Morse_code\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMorse Code\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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\u003eStrings will only have [A-z], [0-9] and space characters\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\u003eA string must be returned with dots (.), dashes (-) and spaces between words\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\u003eFor example: given\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \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\u003estr = 'MATLAB is good'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e return\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \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\u003eystr = '--.--.-...--... ..... --.-------..'\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":59237,"title":"Roman to Integer Conversion","description":"The idea behind this cody problem is to write a code that converts the Roman Numerals to Integers. \r\nA numeral system known as Roman numerals (I, V, X, L, C, D, M), were used in ancient Rome, where letters represented numbers. They were in use in Europe in the late middle ages. The conversion of the Roman numerals and their indian or arabic conversion is listed as follows:\r\n'I' = 1\r\n'V' = 5\r\n'X' = 10\r\n'L' = 50\r\n'C' = 100\r\n'D' = 500\r\n'M' = 1000\r\nHow the conversion works can be seen from this Wikipedia link\r\nhttps://en.wikipedia.org/wiki/Roman_numerals\r\nHave fun with the problem!\r\n","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: 423px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407.5px 211.5px; transform-origin: 407.5px 211.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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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 idea behind this cody problem is to write a code that converts the Roman Numerals to Integers. \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: 384.5px 31.5px; text-align: left; transform-origin: 384.5px 31.5px; white-space-collapse: preserve; 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 numeral system known as Roman numerals (I, V, X, L, C, D, M), were used in ancient Rome, where letters represented numbers. They were in use in Europe in the late middle ages. The conversion of the Roman numerals and their indian or arabic conversion is listed as follows:\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'I' = 1\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'V' = 5\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'X' = 10\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'L' = 50\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'C' = 100\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'D' = 500\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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'M' = 1000\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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=\"\"\u003eHow the conversion works can be seen from this Wikipedia link\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Roman_numerals\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003ehttps://en.wikipedia.org/wiki/Roman_numerals\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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=\"\"\u003eHave fun with the problem!\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: 384.5px 10.5px; text-align: left; transform-origin: 384.5px 10.5px; white-space-collapse: preserve; 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\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function a = romanToInt(s)\r\n  s = x;\r\nend","test_suite":"%%\r\ns = 'I'\r\ny_correct = 1;\r\nassert(isequal(romanToInt(s),y_correct))\r\n\r\n%%\r\ns = 'XXXVIII'\r\ny_correct = 38;\r\nassert(isequal(romanToInt(s),y_correct))\r\n\r\n%%\r\ns = 'MCMLXXVII'\r\ny_correct = 1977\r\nassert(isequal(romanToInt(s),y_correct))\r\n\r\n%%\r\ns = 'MMXXXVIII'\r\ny_correct = 2038\r\nassert(isequal(romanToInt(s),y_correct))\r\n\r\n%%\r\ns = 'MCMXC'\r\ny_correct = 1990\r\nassert(isequal(romanToInt(s),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":2638670,"edited_by":2638670,"edited_at":"2023-11-27T19:10:56.000Z","deleted_by":null,"deleted_at":null,"solvers_count":9,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2023-11-27T19:07:40.000Z","updated_at":"2025-05-10T15:37:27.000Z","published_at":"2023-11-27T19:10:57.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\u003eThe idea behind this cody problem is to write a code that converts the Roman Numerals to Integers. \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\u003eA numeral system known as Roman numerals (I, V, X, L, C, D, M), were used in ancient Rome, where letters represented numbers. They were in use in Europe in the late middle ages. The conversion of the Roman numerals and their indian or arabic conversion is listed as follows:\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'I' = 1\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'V' = 5\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'X' = 10\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'L' = 50\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'C' = 100\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'D' = 500\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'M' = 1000\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\u003eHow the conversion works can be seen from this Wikipedia link\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:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Roman_numerals\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttps://en.wikipedia.org/wiki/Roman_numerals\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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\u003eHave fun with the problem!\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\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":42859,"title":"Convert nested struct-array to numeric array","description":"Sometimes data happens to be nicely structured in a struct-array, distributed over various levels of the struct, according to the hierarchy in the logic of the data acquisition.\r\nFor fitting the data, the relevant elements of the struct-array need to be converted to a simple, multi-dimensional numeric array.\r\n\r\nThat will be your assignment.\r\n\r\nCreate a function struct2mat that takes a struct-array as an input, and returns an array, where dimensions of the output data correspond to the struc-array levels in incremental order. The first output level enters dimension 1 of the output, the 2nd dimension 2, etc.\r\n\r\n  datastruct(1).level2(1).level3(1).data = 1:4;\r\n  ...\r\n  datastruct(4).level2(3).level3(2).data = 4321:4324;\r\n\r\n  dataarray = struct2mat(datastruct)\r\n\r\nshould result in \r\n\r\n  dataarray(1,1,1,1) = 1;\r\n  ...\r\n  dataarray(1,1,1,4) = 4;\r\n  ...\r\n  dataarray(4,3,2,3) = 4323;\r\n\r\n\u003c\u003chttp://i64.tinypic.com/zkrbm1.jpg\u003e\u003e\r\n\r\nI encourage you to write a function that does not use loops to access the different struct-array levels.","description_html":"\u003cp\u003eSometimes data happens to be nicely structured in a struct-array, distributed over various levels of the struct, according to the hierarchy in the logic of the data acquisition.\r\nFor fitting the data, the relevant elements of the struct-array need to be converted to a simple, multi-dimensional numeric array.\u003c/p\u003e\u003cp\u003eThat will be your assignment.\u003c/p\u003e\u003cp\u003eCreate a function struct2mat that takes a struct-array as an input, and returns an array, where dimensions of the output data correspond to the struc-array levels in incremental order. The first output level enters dimension 1 of the output, the 2nd dimension 2, etc.\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003edatastruct(1).level2(1).level3(1).data = 1:4;\r\n...\r\ndatastruct(4).level2(3).level3(2).data = 4321:4324;\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003edataarray = struct2mat(datastruct)\r\n\u003c/pre\u003e\u003cp\u003eshould result in\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003edataarray(1,1,1,1) = 1;\r\n...\r\ndataarray(1,1,1,4) = 4;\r\n...\r\ndataarray(4,3,2,3) = 4323;\r\n\u003c/pre\u003e\u003cimg src = \"http://i64.tinypic.com/zkrbm1.jpg\"\u003e\u003cp\u003eI encourage you to write a function that does not use loops to access the different struct-array levels.\u003c/p\u003e","function_template":"function mat = struct2mat(s)\r\n  c = struct2cell(s);\r\n  mat = [c{:}];\r\nend","test_suite":"%%\r\ndata_ref_temp = rand(5,4,3,2);\r\ndata.siz = size(data_ref_temp);\r\nglobal data\r\n\r\nfor i1 = 1:data.siz(1)\r\n    data.altitude.location(i1) = rand;\r\n    for i2 = 1:data.siz(2)\r\n        data.floor.location(i1).room(i2) = rand;\r\n        for i3 = 1:data.siz(3)\r\n            data.scale.location(i1).room(i2).device(i3) = rand;\r\n            for i4 = 1:data.siz(4)\r\n                data.temperature.location(i1).room(i2).device(i3).sample(i4) = data_ref_temp(i1,i2,i3,i4);\r\n                data.timestamp.location(i1).room(i2).device(i3).sample(i4) = i4;\r\n            end\r\n        end\r\n    end\r\nend\r\n\r\nassert(isequal(struct2mat(data.temperature),data_ref_temp))\r\n\r\n%%\r\nglobal data\r\ndata_ref_time = repmat(shiftdim(1:data.siz(4),-2),data.siz(1:3));\r\nassert(isequal(struct2mat(data.timestamp),data_ref_time))\r\n\r\n%%\r\nglobal data\r\nassert(isequal(struct2mat(data.altitude),data.altitude.location.'))\r\n\r\n%%\r\nglobal data\r\nassert(isequal(struct2mat(data.floor),cat(1,data.floor.location.room)))\r\n\r\n%%\r\nglobal data\r\ndata.scale.location;[ans.room];[ans.device];\r\nassert(isequal(struct2mat(data.scale),permute(reshape(ans,3,4,5),[3 2 1])))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":6556,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-05-23T07:59:17.000Z","updated_at":"2016-05-23T09:37:39.000Z","published_at":"2016-05-23T09:37:39.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\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/image\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/media/image1.JPEG\"}],\"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\u003eSometimes data happens to be nicely structured in a struct-array, distributed over various levels of the struct, according to the hierarchy in the logic of the data acquisition. For fitting the data, the relevant elements of the struct-array need to be converted to a simple, multi-dimensional numeric array.\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\u003eThat will be your assignment.\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 a function struct2mat that takes a struct-array as an input, and returns an array, where dimensions of the output data correspond to the struc-array levels in incremental order. The first output level enters dimension 1 of the output, the 2nd dimension 2, etc.\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[datastruct(1).level2(1).level3(1).data = 1:4;\\n...\\ndatastruct(4).level2(3).level3(2).data = 4321:4324;\\n\\ndataarray = struct2mat(datastruct)]]\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\u003eshould result in\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[dataarray(1,1,1,1) = 1;\\n...\\ndataarray(1,1,1,4) = 4;\\n...\\ndataarray(4,3,2,3) = 4323;]]\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: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=\\\"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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eI encourage you to write a function that does not use loops to access the different struct-array levels.\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\"},{\"partUri\":\"/media/image1.JPEG\",\"contentType\":\"image/JPEG\",\"content\":\"data:image/JPEG;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAEsASwDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2h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pdlNZw48qCSBTGmOm1cYH4UAeG/21rN1oem2ceuX/wBmHiY2NtfRznzJYDjHzfxYz3rf1DSZ3+Id14bi1vV4tPg0IyjZdncWDZBJr1T+xNJ+z2tudLs/ItWD28fkLthYdCgxwfpUraZYNetfGxtTdvH5JnMQ8xk/ulsZx7UAeGafd6tDofgTxKdd1GW8vdSFnOjz5iaISsmNv+6vJqOXxPPPf6Zrml32oL9q1pIfOudUDO8Z+9H9mA2qn3ea9wXQdHW3tbYaTYLBaSeZbx/Z12wtnO5BjCnPpUf/AAi+gee039iab5ryCZn+ypkuOjdOoz1oA8a8i303xV8R2j1S6ivYLR3tka5IaTdGzMcdW29vSn6RfPrWraLpviHW7yw0yPw+lzE63Zi86YkZYtn5iPm/75r2i50TSb24a5utMs553jMTSywKzMhHKkkZx7VFdeGdDvbW3tbrR7Ce3t+IY5LZWWMeijHFAHimj6rr2vr4Ctb3VtSgF3JdwyTRTlJJo1xgk9z1GT/Oup8Da3F4c1bxhp2razL/AGXpt7FFbTX85Ypv8wbdx/3R/OvSjpGmNJayHT7TzLQYtn8lcwg8fIcfL+FRtoWkM1w7aXZlrl1kmP2dcyspyrNxyQemaANOoZPvD6VNUE33/wAKAJV+6KdVVZ22rwP1p/nN7UAT0VB5ze1HnN7UAT0VD5h9BSpIW64oAloqEykdAKd5h9qAJKKh8w+gp28+goAkoqPzD7U7JoAdRTcmjJoAdRUfmH2p2TQA6iofMPoKd5h9qAJKKbk0ZNADqKbk0ZNADqKbk0ZNADqKbk0ZNADqKbk0ZNADqKj3n0FHmH2oAkoqHzD6CpMmgB1FNyab5h9qAJKKh8w+gp3mH2oAkqCb7/4U/efQU0uc9B+VAH//2Q==\"}]}"},{"id":2415,"title":"Temperature Conversion Utility (Strings)","description":"This is a follow-on problem to \u003chttp://www.mathworks.com/matlabcentral/cody/problems/2413-temperature-conversion-utility Problem 2413: Temperature Conversion Utility\u003e.\r\n\r\nYou are provided a cell array of strings that contains the source temperature and units (in various formats) and a separate cell array of strings that contains the target temperature units (in various formats). Produce a numerical vector of converted temperature values. \r\n\r\nExample:\r\n\r\n T_in  = {'100 Celsius', '50degF', '90K', strcat('111',char(176),'R')};  \r\n T_to  = {'R','C','degF','kelvin'}; \r\n T_out = [671.67 10 -297.67 61.6666667];\r\n\r\nFor reference, temperature conversion formulas are available on \u003chttp://en.wikipedia.org/wiki/Temperature_conversion Wikipedia\u003e.","description_html":"\u003cp\u003eThis is a follow-on problem to \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/2413-temperature-conversion-utility\"\u003eProblem 2413: Temperature Conversion Utility\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eYou are provided a cell array of strings that contains the source temperature and units (in various formats) and a separate cell array of strings that contains the target temperature units (in various formats). Produce a numerical vector of converted temperature values.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e T_in  = {'100 Celsius', '50degF', '90K', strcat('111',char(176),'R')};  \r\n T_to  = {'R','C','degF','kelvin'}; \r\n T_out = [671.67 10 -297.67 61.6666667];\u003c/pre\u003e\u003cp\u003eFor reference, temperature conversion formulas are available on \u003ca href = \"http://en.wikipedia.org/wiki/Temperature_conversion\"\u003eWikipedia\u003c/a\u003e.\u003c/p\u003e","function_template":"function [T_out] = T_convertor_str(T_in,T_to)\r\n T_out = 1;\r\nend","test_suite":"%%\r\nT_in = {'100 Celsius', '50degF', '90K', strcat('111',char(176),'R')};\r\nT_to = {'R','C','degF','kelvin'};\r\nT_out = [671.67 10 -297.67 61.6666667];\r\neps = 1e-3;\r\nassert(sum(abs(T_convertor_str(T_in,T_to)-T_out)) \u003c eps)\r\n\r\n%%\r\nT_in = {'10C','20degC','30 Celsius','40 Centigrade',strcat('50',char(176),'C'),'60K','70 kelvin','80 FAHRENHEIT'};\r\nT_to = {'R','R','Rankine','deg R','R','R',strcat(char(176),'R'),'degR'};\r\nT_out = [509.67 527.67 545.67 563.67 581.67 108 126 539.67];\r\neps = 1e-3;\r\nassert(sum(abs(T_convertor_str(T_in,T_to)-T_out)) \u003c eps)\r\n\r\n%%\r\nT_in = {'100 DEGREES RANKINE','100degC','100K','100F','1000R','1000 centigrade','1000 deg F','1000 kelvin'};\r\nT_to = {'C','degC',strcat(char(176),'C'),'Celsius','centigrade','deg C','degrees Celsius','CENTIGRADE'};\r\nT_out = [-217.5944444 100 -173.15 37.7777778 282.4055556 1000 537.7777778 726.85];\r\neps = 1e-3;\r\nassert(sum(abs(T_convertor_str(T_in,T_to)-T_out)) \u003c eps)\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":29,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-11T18:21:42.000Z","updated_at":"2026-04-03T03:10:48.000Z","published_at":"2014-07-11T18:21: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\",\"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\u003eThis is a follow-on problem to\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/2413-temperature-conversion-utility\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 2413: Temperature Conversion Utility\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\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYou are provided a cell array of strings that contains the source temperature and units (in various formats) and a separate cell array of strings that contains the target temperature units (in various formats). Produce a numerical vector of converted temperature values.\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\u003eExample:\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[ T_in  = {'100 Celsius', '50degF', '90K', strcat('111',char(176),'R')};  \\n T_to  = {'R','C','degF','kelvin'}; \\n T_out = [671.67 10 -297.67 61.6666667];]]\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\u003eFor reference, temperature conversion formulas are available on\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://en.wikipedia.org/wiki/Temperature_conversion\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eWikipedia\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":60783,"title":"Convert integers from base 10 to proper primary notation ","description":"This problem is the companion to Cody Problem 60782. The proper primary system of expressing non-negative numbers has three digits: m, x, and p, which correspond to -1, 0, and 1. The places in a proper primary number correspond to the prime numbers. For example, the number 6 would be ppm in proper primary notation because . Similarly, the number 20 would be ppxxp in proper primary notation. \r\nBecause integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a non-negative number can exist. However, numbers in proper primary notation adhere to the following requirement: when m, x, and p are replaced with 0, 1, and 2, respectively, the resulting decimal number is minimal.\r\nFor instance, 5 can be represented as pp, pxx, and pxxm; since 22 is smaller than 211 or 2100, pp is the proper primary representation of 5. The number 12 can be represented as pxpp and ppxx; since 2122 is less than 2211, pxpp is the proper primary representation of 12. The number -15 can be represented as mmmx and mmxpx; since 1 is less than 121, mmmx is the proper primary representation of -15. \r\nWrite a function to convert non-negative integers in base 10 to proper primary notation.","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: 279px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 139.5px; transform-origin: 408px 139.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: 385px 42px; text-align: left; transform-origin: 385px 42px; white-space-collapse: preserve; 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis problem is the companion to \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/60782-convert-integers-from-proper-primary-to-base-10\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003eCody Problem 60782\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. The \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eproper primary \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003esystem of expressing non-negative numbers has three digits: \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003em\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ex\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ep\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, which correspond to -1, 0, and 1. The places in a proper primary number correspond to the prime numbers. For example, the number 6 would be \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eppm\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in proper primary notation because \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-5px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUYAAAAkCAYAAAD1nJMVAAAAAXNSR0IArs4c6QAAC2VJREFU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Rc8xffFyUtwApxEbD2B8kzlRQjN42sbs+jlSK04cYiKhAeeXv5i6vquuf9/OF/aGr4T+LyuZ5is6U5+RG5lwCOaViq9kOJF88ARX0p7MJmrw9S3p9A2MW5mmVldMubi+Q82pac9hXsOJg/AUW2Jt0b296LoC7BST4UJBGKptbRW88bpSsp4Du4ZtLkIviP0hYyRlqlcoUykz9B4DerzONDJ2sNmgQjMPDnaKhkkCUKYc2oYFAqAHMR9w5KcPPvcNjFR3QRLHKeDTKolTRO0DNIlh7IPuRdaFGomvM9sc1bt9IwSNfF8uRwKlKU4c2/oExk1MAvT7tI222FCmtvdXfY76TnA4fOwSB7nIWOVnYtcVrYxSigh0jdXH24Cxj8nkd0yDA30Xqp3GrNJT0Xeh2vQzaqcACRztgAs9VW2BdipX7IEk/jmrlE8yRmPLwNjGofx55kDmQBUHcA5RvoufcgX3qXEM7Yb6sti662y2K9CcgXFqS5jpyRyYDweo7I+9kciUqX4XFKBIlg/mv+Bv/8zAOJ9NmCnNHJgiB0iOoJhKZSXsCRDMl4phT+z0lRMZGCewcpmEzIHMgWlxIAPjtNYjU5M5kDkwAQ5kYJzAImQSMgcyB6bFgQyM01qPTE3mQObABDiQgXECi5BJyBzIHJgWB+4CiJDsQ5Nw4hIAAAAASUVORK5CYII=\" width=\"163\" height=\"18\" style=\"width: 163px; height: 18px;\"\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Similarly, the number 20 would be \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eppxxp\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e in proper primary notation. \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: 385px 31.5px; text-align: left; transform-origin: 385px 31.5px; white-space-collapse: preserve; 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBecause integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a non-negative number can exist. However, numbers 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003eproper\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e primary notation adhere to the following requirement: when \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003em\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ex\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003ep\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e are replaced with 0, 1, and 2, respectively, the resulting decimal number is minimal.\u003c/span\u003e\u003c/span\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: 385px 42px; text-align: left; transform-origin: 385px 42px; white-space-collapse: preserve; 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor instance, 5 can be represented 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epp\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epxx\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epxxm\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e; since 22 is smaller than 211 or 2100, \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epp\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is the proper primary representation of 5. The number 12 can be represented 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003epxpp\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eppxx\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e; since 2122 is less than 2211, pxpp is the proper primary representation of 12. The number -15 can be represented 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003emmmx\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003emmxpx\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e; since 1 is less than 121, \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; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003emmmx\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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is the proper primary representation of -15. \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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; 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; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to convert non-negative integers in base 10 to proper primary notation.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function s = properPrimary(n)\r\n  s = dec2base(n,primes(n));\r\nend","test_suite":"%%\r\nn = 6;\r\ns = properPrimary(n);\r\ns_correct = 'ppm';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 20;\r\ns = properPrimary(n);\r\ns_correct = 'ppxxp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 0;\r\ns = properPrimary(n);\r\ns_correct = 'x';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 1;\r\ns = properPrimary(n);\r\ns_correct = 'pm';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 40;\r\ns = properPrimary(n);\r\ns_correct = 'pxppxpp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 280;\r\ns = properPrimary(n);\r\ns_correct = 'pxppppppppppxpp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 743;\r\ns = properPrimary(n);\r\ns_correct = 'ppppppppxppppppppppxpp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 153488;\r\ns = properPrimary(n);\r\ns_correct = 'pppppppppppppppppppppppppppppppppppppppppppxpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppxppppxp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 444555;\r\ns = properPrimary(n);\r\ns_correct = 'pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppxppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 2438900;\r\ns = properPrimary(n);\r\ns_correct = 'pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppxpppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nn = 5674321;\r\ns = properPrimary(n);\r\ns_correct = 'pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppxppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppx';\r\nassert(isequal(s,s_correct))\r\n\r\n%%\r\nfiletext = fileread('properPrimary.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'assert') || contains(filetext,'str2num'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":0,"comments_count":12,"created_by":46909,"edited_by":46909,"edited_at":"2025-04-06T16:52:52.000Z","deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":"2025-01-09T01:09:44.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2024-12-31T21:47:07.000Z","updated_at":"2026-03-15T22:17:28.000Z","published_at":"2024-12-31T21:47:42.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\u003eThis problem is the companion to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/60782-convert-integers-from-proper-primary-to-base-10\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCody Problem 60782\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. The \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eproper primary \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003esystem of expressing non-negative numbers has three digits: \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\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, \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\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and \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\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, which correspond to -1, 0, and 1. The places in a proper primary number correspond to the prime numbers. For example, the number 6 would be \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\u003eppm\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in proper primary notation because \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003e6 = 5\\\\cdot 1 + 3\\\\cdot 1 + 2\\\\cdot(-1)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e. Similarly, the number 20 would be \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\u003eppxxp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e in proper primary notation. \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\u003eBecause integers can be expressed as sums (and differences) of primes in several ways, several primary notations for a non-negative number can exist. However, numbers in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eproper\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e primary notation adhere to the following requirement: when \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\u003em\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, \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\u003ex\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and \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\u003ep\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e are replaced with 0, 1, and 2, respectively, the resulting decimal number is minimal.\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\u003eFor instance, 5 can be represented 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\u003epp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, \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\u003epxx\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and \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\u003epxxm\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e; since 22 is smaller than 211 or 2100, \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\u003epp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the proper primary representation of 5. The number 12 can be represented 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\u003epxpp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and \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\u003eppxx\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e; since 2122 is less than 2211, pxpp is the proper primary representation of 12. The number -15 can be represented 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\u003emmmx\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and \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\u003emmxpx\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e; since 1 is less than 121, \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\u003emmmx\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the proper primary representation of -15. \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 convert non-negative integers in base 10 to proper primary notation.\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\"}]}"}],"term":"tag:\"conversion\"","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:\"conversion\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"conversion\"","","\"","conversion","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f64e60bfac0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f64e60bfa20\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f64e60bf160\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f64e60bfd40\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f64e60bfca0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f64e60bfc00\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f64e60bfb60\u003e":"tag:\"conversion\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f64e60bfb60\u003e":"tag:\"conversion\""},"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":"cody-search","password":"78X075ddcV44","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:\"conversion\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"conversion\"","","\"","conversion","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f64e60bfac0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f64e60bfa20\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f64e60bf160\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f64e60bfd40\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f64e60bfca0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f64e60bfc00\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f64e60bfb60\u003e":"tag:\"conversion\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f64e60bfb60\u003e":"tag:\"conversion\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":57978,"difficulty_rating":"easy"},{"id":43010,"difficulty_rating":"easy"},{"id":42655,"difficulty_rating":"easy"},{"id":43802,"difficulty_rating":"easy"},{"id":43214,"difficulty_rating":"easy"},{"id":45281,"difficulty_rating":"easy"},{"id":44429,"difficulty_rating":"easy"},{"id":1603,"difficulty_rating":"easy"},{"id":55425,"difficulty_rating":"easy"},{"id":2215,"difficulty_rating":"easy"},{"id":43830,"difficulty_rating":"easy"},{"id":49037,"difficulty_rating":"easy"},{"id":49052,"difficulty_rating":"easy"},{"id":2997,"difficulty_rating":"easy"},{"id":43215,"difficulty_rating":"easy"},{"id":44428,"difficulty_rating":"easy"},{"id":49047,"difficulty_rating":"easy"},{"id":1338,"difficulty_rating":"easy"},{"id":43672,"difficulty_rating":"easy"},{"id":2204,"difficulty_rating":"easy"},{"id":49082,"difficulty_rating":"easy-medium"},{"id":8045,"difficulty_rating":"easy-medium"},{"id":540,"difficulty_rating":"easy-medium"},{"id":49077,"difficulty_rating":"easy-medium"},{"id":45327,"difficulty_rating":"easy-medium"},{"id":60782,"difficulty_rating":"easy-medium"},{"id":49087,"difficulty_rating":"easy-medium"},{"id":1948,"difficulty_rating":"easy-medium"},{"id":49072,"difficulty_rating":"easy-medium"},{"id":49057,"difficulty_rating":"easy-medium"},{"id":49062,"difficulty_rating":"easy-medium"},{"id":8046,"difficulty_rating":"easy-medium"},{"id":2283,"difficulty_rating":"easy-medium"},{"id":42849,"difficulty_rating":"easy-medium"},{"id":49067,"difficulty_rating":"easy-medium"},{"id":8047,"difficulty_rating":"easy-medium"},{"id":49835,"difficulty_rating":"easy-medium"},{"id":2413,"difficulty_rating":"easy-medium"},{"id":1378,"difficulty_rating":"easy-medium"},{"id":2046,"difficulty_rating":"medium"},{"id":394,"difficulty_rating":"medium"},{"id":59237,"difficulty_rating":"medium"},{"id":42859,"difficulty_rating":"medium"},{"id":2415,"difficulty_rating":"medium-hard"},{"id":60783,"difficulty_rating":"hard"}]}}