{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":43330,"title":"Solve expression III","description":"Solve expression for given vector x.\r\nExpression = (tan(2*x^2+7*x-30.25)+log(x^3-2.25))/(nthroot(sin(x^3)^2+1/5*log(x^4-2.5),3))","description_html":"\u003cp\u003eSolve expression for given vector x.\r\nExpression = (tan(2*x^2+7*x-30.25)+log(x^3-2.25))/(nthroot(sin(x^3)^2+1/5*log(x^4-2.5),3))\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 2:4;\r\ny_correct =(tan(2.*x.^2+7.*x-30.25)+log(x.^3-2.25))./(nthroot(sin(x.^3).^2+1/5*log(x.^4-2.5),3));\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 6;\r\ny_correct =(tan(2.*x.^2+7.*x-30.25)+log(x.^3-2.25))./(nthroot(sin(x.^3).^2+1/5*log(x.^4-2.5),3));\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 30:2:40;\r\ny_correct =(tan(2.*x.^2+7.*x-30.25)+log(x.^3-2.25))./(nthroot(sin(x.^3).^2+1/5*log(x.^4-2.5),3));\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":3,"created_by":90467,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":90,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-11T09:42:37.000Z","updated_at":"2026-03-31T10:18:41.000Z","published_at":"2016-10-11T09:42:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolve expression for given vector x. Expression = (tan(2*x^2+7*x-30.25)+log(x^3-2.25))/(nthroot(sin(x^3)^2+1/5*log(x^4-2.5),3))\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":43687,"title":"Change on Spiral Matrix","description":"n\u003e=3, generate a matrix of nth such that n^2 is the max number, and max number must be in [1,1] or [end, end]. One example will be suggested below:\r\nExample : n=4\r\nanswer :\r\n10  9  8  7\r\n11  2  1  6\r\n12  3  4  5\r\n13  14 15 16 ","description_html":"\u003cp\u003en\u0026gt;=3, generate a matrix of nth such that n^2 is the max number, and max number must be in [1,1] or [end, end]. One example will be suggested below:\r\nExample : n=4\r\nanswer :\r\n10  9  8  7\r\n11  2  1  6\r\n12  3  4  5\r\n13  14 15 16\u003c/p\u003e","function_template":"function y = your_fcn_name(n)\r\n  y = n ;\r\nend","test_suite":"%%\r\nn = 5;\r\ny_correct = [25 24 23 22 21;10 9 8 7 20;11 2 1 6 19;12 3 4 5 18;13 14 15 16 17];\r\nassert(isequal(your_fcn_name(n),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":89616,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":59,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-11-27T14:08:23.000Z","updated_at":"2026-03-15T03:52:53.000Z","published_at":"2016-11-27T14:09:43.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\u003en\u0026gt;=3, generate a matrix of nth such that n^2 is the max number, and max number must be in [1,1] or [end, end]. One example will be suggested below: Example : n=4 answer : 10 9 8 7 11 2 1 6 12 3 4 5 13 14 15 16\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":43551,"title":"I told you not separate me, but you did :( - ACDC","description":"Given input vector, output it's DC and AC value\r\n\r\nExample:\r\n\r\ninput = 0 1 -1 0\r\nac = 0 1 -1 0\r\ndc = 0","description_html":"\u003cp\u003eGiven input vector, output it's DC and AC value\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003einput = 0 1 -1 0\r\nac = 0 1 -1 0\r\ndc = 0\u003c/p\u003e","function_template":"function [ac dc] = acDC(x)\r\n  ac = x;\r\n  dc = x;\r\nend","test_suite":"%%\r\nx = [0 1 -1 0];\r\nac_correct = [0 1 -1 0];\r\ndc_correct = 0;\r\n[ac dc] = acDC(x);\r\nassert(isequal(ac,ac_correct))\r\nassert(isequal(dc,dc_correct))\r\n%%\r\nx = [5 6 4 5];\r\nac_correct = [0 1 -1 0];\r\ndc_correct = 5;\r\n[ac dc] = acDC(x);\r\nassert(isequal(ac,ac_correct))\r\nassert(isequal(dc,dc_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":13865,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":62,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-14T10:20:04.000Z","updated_at":"2026-03-02T17:29:19.000Z","published_at":"2016-10-14T10:20:04.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 vector, output it's DC and AC value\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003einput = 0 1 -1 0 ac = 0 1 -1 0 dc = 0\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":43329,"title":"Solve expression II","description":"Solve given expression.\r\n\r\nalpha=0.1(-x-y-50)/(exp((-x-y-50)/10)-1)\r\n\r\nbeta=5exp((-x+y-60)/20)\r\n\r\nresult=alpha+beta;","description_html":"\u003cp\u003eSolve given expression.\u003c/p\u003e\u003cp\u003ealpha=0.1(-x-y-50)/(exp((-x-y-50)/10)-1)\u003c/p\u003e\u003cp\u003ebeta=5exp((-x+y-60)/20)\u003c/p\u003e\u003cp\u003eresult=alpha+beta;\u003c/p\u003e","function_template":"function z = your_fcn_name(x,y)\r\n  z = x+y;\r\nend","test_suite":"%%\r\nx = 1;\r\ny = 1;\r\nbeta=5.*exp((-x+y-60)/20);\r\nalpha=0.1.*(-x-y-50)./(exp((-x-y-50)/10)-1);\r\ny_correct = alpha+beta;\r\nassert(isequal(your_fcn_name(x,y),y_correct))\r\n%%\r\nx = 1:10;\r\ny = 1:10;\r\nbeta=5.*exp((-x+y-60)/20);\r\nalpha=0.1.*(-x-y-50)./(exp((-x-y-50)/10)-1);\r\ny_correct = alpha+beta;\r\nassert(isequal(your_fcn_name(x,y),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":90467,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":94,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-11T09:22:33.000Z","updated_at":"2026-03-31T10:24:37.000Z","published_at":"2016-10-11T09:22:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolve given expression.\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\u003ealpha=0.1(-x-y-50)/(exp((-x-y-50)/10)-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\u003ebeta=5exp((-x+y-60)/20)\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\u003eresult=alpha+beta;\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":43747,"title":"Find the distance traveled by a car given velocity and time.","description":"A car is traveling at a constant velocity for a specific amount of time. The function should use the two inputs, velocity and time, to find the distance traveled.","description_html":"\u003cp\u003eA car is traveling at a constant velocity for a specific amount of time. The function should use the two inputs, velocity and time, to find the distance traveled.\u003c/p\u003e","function_template":"function y = distance(velocity,time)\r\n  D = time;\r\nend","test_suite":"%%\r\nvelocity = 10;\r\ntime = 60; \r\nD_correct = 600;\r\nassert(isequal(distance(velocity,time),D_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":100857,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":130,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-12-07T20:05:40.000Z","updated_at":"2026-02-10T21:28:41.000Z","published_at":"2016-12-07T20:05:40.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\u003eA car is traveling at a constant velocity for a specific amount of time. The function should use the two inputs, velocity and time, to find the distance traveled.\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":43326,"title":"Solve expression I","description":"Solve expression (1+sin(x))/cos(x)+cos(x)/(1+sin(x)) for given vector x.","description_html":"\u003cp\u003eSolve expression (1+sin(x))/cos(x)+cos(x)/(1+sin(x)) for given vector x.\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [2     -3     4];\r\ny_correct =  (1.+sin(x))./cos(x)+cos(x)/(1.+sin(x));\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 1:3:100;\r\ny_correct =  (1.+sin(x))./cos(x)+cos(x)/(1.+sin(x));\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":4,"created_by":90467,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":101,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-11T09:03:10.000Z","updated_at":"2026-03-16T01:33:02.000Z","published_at":"2016-10-11T09:03:10.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolve expression (1+sin(x))/cos(x)+cos(x)/(1+sin(x)) for given vector x.\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":43617,"title":"Calculate the values of a polynomial.","description":"Calculate the values of a polynomial.Input parameter p - vector of polynomial coefficients, x - matrix of the argument values.\r\n\r\nExample \r\n\r\np=[-1 1]\r\n\r\nx=[1 2;3 4]\r\n\r\nresult=[ 0 -1; -2 -3]","description_html":"\u003cp\u003eCalculate the values of a polynomial.Input parameter p - vector of polynomial coefficients, x - matrix of the argument values.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cp\u003ep=[-1 1]\u003c/p\u003e\u003cp\u003ex=[1 2;3 4]\u003c/p\u003e\u003cp\u003eresult=[ 0 -1; -2 -3]\u003c/p\u003e","function_template":"function y = SolvePoly(p,x)\r\n  y = x;\r\nend","test_suite":"%%\r\np=[-1 1]\r\nx=[1 2;3 4]\r\ny_correct=[ 0 -1; -2 -3]\r\nassert(isequal(SolvePoly(p,x),y_correct))\r\n%%\r\np=[-2     0     1    -1     3     2]\r\nx=[5 6 11; 2 13 7; 4 9 21]\r\ny_correct=[-6133      -15352     -320857;\r\n           -52        -740517    -33297;\r\n           -1986      -117421    -8159317]\r\nassert(isequal(SolvePoly(p,x),y_correct))       ","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":90467,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":87,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-24T22:55:06.000Z","updated_at":"2026-02-25T20:49:54.000Z","published_at":"2016-10-24T22:55: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\u003eCalculate the values of a polynomial.Input parameter p - vector of polynomial coefficients, x - matrix of the argument 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ep=[-1 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\u003ex=[1 2;3 4]\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\u003eresult=[ 0 -1; -2 -3]\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":43737,"title":"Alternative Dimensions","description":"Given a multidimensional matrix, transform the matrix so the dimensions are in the order given by variable ord. For example, given the following matrix:\r\n\r\nm has 3 dimensions\r\n\r\n  m(1,:,:) = all 1s\r\n  m(2,:,:) = all 2s\r\n  m(3,:,:) = all 3s\r\n\r\nAfter the transformation to [3 2 1], the matrix should be:\r\n\r\n  m(:,:,1) = all 1s\r\n  m(:,:,2) = all 2s\r\n  m(:,:,3) = all 3s","description_html":"\u003cp\u003eGiven a multidimensional matrix, transform the matrix so the dimensions are in the order given by variable ord. For example, given the following matrix:\u003c/p\u003e\u003cp\u003em has 3 dimensions\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003em(1,:,:) = all 1s\r\nm(2,:,:) = all 2s\r\nm(3,:,:) = all 3s\r\n\u003c/pre\u003e\u003cp\u003eAfter the transformation to [3 2 1], the matrix should be:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003em(:,:,1) = all 1s\r\nm(:,:,2) = all 2s\r\nm(:,:,3) = all 3s\r\n\u003c/pre\u003e","function_template":"function y = transform(M,ord)\r\n  y = x;\r\nend","test_suite":"%%\r\nM=ones(3,3,3);\r\nM(2,:,:)=2.*M(2,:,:);\r\nM(3,:,:)=3.*M(3,:,:);\r\nord = [3,2,1];\r\nMC = ones(3,3,3);\r\nMC(:,:,2)=2.*MC(:,:,2);\r\nMC(:,:,3)=3.*MC(:,:,3);\r\nassert(isequal(transform(M,ord),MC))\r\n%%\r\nM=rand(1,2,3,4,5,6);\r\nord = [6 1 5 2 4 3];\r\nassert(isequal(size(transform(M,ord)),ord))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":93456,"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":"2016-12-06T23:42:04.000Z","updated_at":"2026-02-19T15:41:13.000Z","published_at":"2016-12-06T23:42:04.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 multidimensional matrix, transform the matrix so the dimensions are in the order given by variable ord. For example, given the following matrix:\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\u003em has 3 dimensions\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[m(1,:,:) = all 1s\\nm(2,:,:) = all 2s\\nm(3,:,:) = all 3s]]\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\u003eAfter the transformation to [3 2 1], the matrix should be:\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[m(:,:,1) = all 1s\\nm(:,:,2) = all 2s\\nm(:,:,3) = all 3s]]\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":43479,"title":"Modulation index","description":"The amplitude of the carrier signal is 2V and the amplitude of the modulating signal is 8V. Find its modulation index.","description_html":"\u003cp\u003eThe amplitude of the carrier signal is 2V and the amplitude of the modulating signal is 8V. Find its modulation index.\u003c/p\u003e","function_template":"function z = your_fcn_name(x,y)\r\n  z = ;\r\nend","test_suite":"%%\r\nx = 8; y=2;\r\nz_correct = 4;\r\nassert(isequal(your_fcn_name(x,y),z_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":87885,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":89,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-11T22:34:12.000Z","updated_at":"2026-02-06T15:38:09.000Z","published_at":"2016-10-11T22:34:12.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe amplitude of the carrier signal is 2V and the amplitude of the modulating signal is 8V. Find its modulation index.\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":44008,"title":"intervals","description":"Write a function that takes an interval from a to b, and divides it into 6 parts.\r\n","description_html":"\u003cp\u003eWrite a function that takes an interval from a to b, and divides it into 6 parts.\u003c/p\u003e","function_template":"function y = split_to_six(a,b)\r\n  y = ...;\r\nend","test_suite":"%%\r\n%%\r\na = 1; b=2;\r\ny_correct = [1 1.2 1.4 1.6 1.8 2];\r\nassert(isequal(split_to_six(a,b),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":110067,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":91,"test_suite_updated_at":"2017-01-17T19:12:24.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-01-17T19:12:09.000Z","updated_at":"2026-03-18T23:45:39.000Z","published_at":"2017-01-17T19:12:24.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes an interval from a to b, and divides it into 6 parts.\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":43298,"title":"Calculate area of sector","description":"A=function(r,seta)\r\n\r\nr is radius of sector, seta is angle of sector, and A is its area. Area of sector A is defined as 0.5*(r^2)*seta;","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=\"\"\u003eA=function(r,seta)\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=\"\"\u003er(m) is radius of sector, seta (radian) is angle of sector, and A (m^2) is its area.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = sectorarea(r,seta)\r\n  y =\r\nend","test_suite":"%%\r\nr=1\r\nseta=pi/2\r\ny_correct = 0.7854;\r\nassert(abs(sectorarea(r,seta)-y_correct)\u003c0.001)\r\n\r\n%%\r\nr=2\r\nseta=pi/2\r\ny_correct = pi;\r\nassert(abs(sectorarea(r,seta)-y_correct)\u003c0.001)\r\n\r\n%%\r\nr=sqrt(2);\r\nseta=pi/3\r\ny_correct = pi/3;\r\nassert(abs(sectorarea(r,seta)-y_correct)\u003c0.001)\r\n\r\n%%\r\nr= 6\r\nseta=pi/6;\r\ny_correct = 3*pi;\r\nassert(abs(sectorarea(r,seta)-y_correct)\u003c0.001)\r\n\r\n%%\r\nr= pi\r\nseta= pi\r\ny_correct = 0.5*pi^3;\r\nassert(abs(sectorarea(r,seta)-y_correct)\u003c0.001)\r\n","published":true,"deleted":false,"likes_count":21,"comments_count":6,"created_by":33533,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3452,"test_suite_updated_at":"2021-02-21T07:46:40.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2016-10-10T09:02:12.000Z","updated_at":"2026-04-03T16:02:03.000Z","published_at":"2016-10-10T09:02:12.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA=function(r,seta)\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\u003er(m) is radius of sector, seta (radian) is angle of sector, and A (m^2) is its area.\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":43301,"title":"Calculate inverse matrix in m by n matrix ","description":"  x=(1:10)'\r\n  y=roundn(2*x+7*rand(size(x)),-1)\r\n\r\na*x=y\r\n\r\nEstimate a using inverse matrix calculation. This is principle of linear regression.","description_html":"\u003cpre class=\"language-matlab\"\u003ex=(1:10)'\r\ny=roundn(2*x+7*rand(size(x)),-1)\r\n\u003c/pre\u003e\u003cp\u003ea*x=y\u003c/p\u003e\u003cp\u003eEstimate a using inverse matrix calculation. This is principle of linear regression.\u003c/p\u003e","function_template":"function a = reginv(x,y)\r\n  a =\r\nend","test_suite":"%%\r\n  x=(1:10)'\r\n  y=3*x\r\n  a=3\r\n\r\nassert(abs(reginv(x,y)-a)\u003c0.001)\r\n\r\n%%\r\n  x=(1:10)'\r\n  y=3*x+2\r\n  a=3.2857\r\n\r\nassert(abs(reginv(x,y)-a)\u003c0.001)\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":2,"created_by":33533,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":89,"test_suite_updated_at":"2018-07-19T15:35:54.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-10T09:36:59.000Z","updated_at":"2026-01-02T15:53:13.000Z","published_at":"2016-10-10T09:36:59.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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[x=(1:10)'\\ny=roundn(2*x+7*rand(size(x)),-1)]]\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*x=y\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\u003eEstimate a using inverse matrix calculation. This is principle of linear regression.\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":43553,"title":"Linear Least Squares (L2 fitting problem )","description":"Given a set of real measurements\r\n\r\n     (x(i), y(i))\r\n\r\nfind a line sol(1)x + sol(2) (more specifically furnish the vector with sol=[sol(1),sol(2)])such that it fits the data (it minimises the 2 norm)\r\n\r\n_Example:_ Input:\r\n\r\n  % INPUT\r\n  x=linspace(0,1,50);\r\n  y=4*x-1+ randn(50,1); % perturbed observations\r\n  % SOLUTION:\r\n  sol=[4,-1]\r\n\r\n*HINT :* This problem can be expressed as a convex optimisation problem:\r\n\r\n  min_{sol} sum(sol(1)*x+sol(2)-y)^2   \r\n\r\n*Suggestion:* use the following code to test your function:\r\n\r\n  plot(x,y,'.') % plot the data\r\n  hold on\r\n  plot(x,sol(1)*x+sol(2))\r\n  legend('measurements', 'L2 fit')","description_html":"\u003cp\u003eGiven a set of real measurements\u003c/p\u003e\u003cpre\u003e     (x(i), y(i))\u003c/pre\u003e\u003cp\u003efind a line sol(1)x + sol(2) (more specifically furnish the vector with sol=[sol(1),sol(2)])such that it fits the data (it minimises the 2 norm)\u003c/p\u003e\u003cp\u003e\u003ci\u003eExample:\u003c/i\u003e Input:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e% INPUT\r\nx=linspace(0,1,50);\r\ny=4*x-1+ randn(50,1); % perturbed observations\r\n% SOLUTION:\r\nsol=[4,-1]\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eHINT :\u003c/b\u003e This problem can be expressed as a convex optimisation problem:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003emin_{sol} sum(sol(1)*x+sol(2)-y)^2   \r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eSuggestion:\u003c/b\u003e use the following code to test your function:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eplot(x,y,'.') % plot the data\r\nhold on\r\nplot(x,sol(1)*x+sol(2))\r\nlegend('measurements', 'L2 fit')\r\n\u003c/pre\u003e","function_template":"function sol = Lls2(x,y) % Linear least squares with 2 norm\r\n  y = sol(1)*x+sol(2);  \r\nend","test_suite":"%%\r\nx=linspace(0,1,50)';\r\ny=4*x-1+ randn(50,1); % perturbed observations\r\nsol = Lls2(x,y)\r\nassert(abs(sum(Lls2(x,y))-4+1)\u003c2)\r\n\r\n\r\n%%\r\nx=linspace(0,1,50)';\r\ny=7*x+45+ randn(50,1); % perturbed observations\r\nsol = Lls2(x,y)\r\nassert(abs(sum(Lls2(x,y))-7-45)\u003c2)","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":85837,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":15,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-14T12:57:52.000Z","updated_at":"2016-10-14T12:57:52.000Z","published_at":"2016-10-14T12:57: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\",\"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 set of real measurements\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[     (x(i), y(i))]]\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\u003efind a line sol(1)x + sol(2) (more specifically furnish the vector with sol=[sol(1),sol(2)])such that it fits the data (it minimises the 2 norm)\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\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Input:\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\\nx=linspace(0,1,50);\\ny=4*x-1+ randn(50,1); % perturbed observations\\n% SOLUTION:\\nsol=[4,-1]]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHINT :\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e This problem can be expressed as a convex optimisation problem:\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[min_{sol} sum(sol(1)*x+sol(2)-y)^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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSuggestion:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e use the following code to test your function:\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[plot(x,y,'.') % plot the data\\nhold on\\nplot(x,sol(1)*x+sol(2))\\nlegend('measurements', 'L2 fit')]]\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\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":43330,"title":"Solve expression III","description":"Solve expression for given vector x.\r\nExpression = (tan(2*x^2+7*x-30.25)+log(x^3-2.25))/(nthroot(sin(x^3)^2+1/5*log(x^4-2.5),3))","description_html":"\u003cp\u003eSolve expression for given vector x.\r\nExpression = (tan(2*x^2+7*x-30.25)+log(x^3-2.25))/(nthroot(sin(x^3)^2+1/5*log(x^4-2.5),3))\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 2:4;\r\ny_correct =(tan(2.*x.^2+7.*x-30.25)+log(x.^3-2.25))./(nthroot(sin(x.^3).^2+1/5*log(x.^4-2.5),3));\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 6;\r\ny_correct =(tan(2.*x.^2+7.*x-30.25)+log(x.^3-2.25))./(nthroot(sin(x.^3).^2+1/5*log(x.^4-2.5),3));\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 30:2:40;\r\ny_correct =(tan(2.*x.^2+7.*x-30.25)+log(x.^3-2.25))./(nthroot(sin(x.^3).^2+1/5*log(x.^4-2.5),3));\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":3,"created_by":90467,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":90,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-11T09:42:37.000Z","updated_at":"2026-03-31T10:18:41.000Z","published_at":"2016-10-11T09:42:37.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolve expression for given vector x. Expression = (tan(2*x^2+7*x-30.25)+log(x^3-2.25))/(nthroot(sin(x^3)^2+1/5*log(x^4-2.5),3))\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":43687,"title":"Change on Spiral Matrix","description":"n\u003e=3, generate a matrix of nth such that n^2 is the max number, and max number must be in [1,1] or [end, end]. One example will be suggested below:\r\nExample : n=4\r\nanswer :\r\n10  9  8  7\r\n11  2  1  6\r\n12  3  4  5\r\n13  14 15 16 ","description_html":"\u003cp\u003en\u0026gt;=3, generate a matrix of nth such that n^2 is the max number, and max number must be in [1,1] or [end, end]. One example will be suggested below:\r\nExample : n=4\r\nanswer :\r\n10  9  8  7\r\n11  2  1  6\r\n12  3  4  5\r\n13  14 15 16\u003c/p\u003e","function_template":"function y = your_fcn_name(n)\r\n  y = n ;\r\nend","test_suite":"%%\r\nn = 5;\r\ny_correct = [25 24 23 22 21;10 9 8 7 20;11 2 1 6 19;12 3 4 5 18;13 14 15 16 17];\r\nassert(isequal(your_fcn_name(n),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":89616,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":59,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-11-27T14:08:23.000Z","updated_at":"2026-03-15T03:52:53.000Z","published_at":"2016-11-27T14:09:43.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\u003en\u0026gt;=3, generate a matrix of nth such that n^2 is the max number, and max number must be in [1,1] or [end, end]. One example will be suggested below: Example : n=4 answer : 10 9 8 7 11 2 1 6 12 3 4 5 13 14 15 16\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":43551,"title":"I told you not separate me, but you did :( - ACDC","description":"Given input vector, output it's DC and AC value\r\n\r\nExample:\r\n\r\ninput = 0 1 -1 0\r\nac = 0 1 -1 0\r\ndc = 0","description_html":"\u003cp\u003eGiven input vector, output it's DC and AC value\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003einput = 0 1 -1 0\r\nac = 0 1 -1 0\r\ndc = 0\u003c/p\u003e","function_template":"function [ac dc] = acDC(x)\r\n  ac = x;\r\n  dc = x;\r\nend","test_suite":"%%\r\nx = [0 1 -1 0];\r\nac_correct = [0 1 -1 0];\r\ndc_correct = 0;\r\n[ac dc] = acDC(x);\r\nassert(isequal(ac,ac_correct))\r\nassert(isequal(dc,dc_correct))\r\n%%\r\nx = [5 6 4 5];\r\nac_correct = [0 1 -1 0];\r\ndc_correct = 5;\r\n[ac dc] = acDC(x);\r\nassert(isequal(ac,ac_correct))\r\nassert(isequal(dc,dc_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":13865,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":62,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-14T10:20:04.000Z","updated_at":"2026-03-02T17:29:19.000Z","published_at":"2016-10-14T10:20:04.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 vector, output it's DC and AC value\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003einput = 0 1 -1 0 ac = 0 1 -1 0 dc = 0\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":43329,"title":"Solve expression II","description":"Solve given expression.\r\n\r\nalpha=0.1(-x-y-50)/(exp((-x-y-50)/10)-1)\r\n\r\nbeta=5exp((-x+y-60)/20)\r\n\r\nresult=alpha+beta;","description_html":"\u003cp\u003eSolve given expression.\u003c/p\u003e\u003cp\u003ealpha=0.1(-x-y-50)/(exp((-x-y-50)/10)-1)\u003c/p\u003e\u003cp\u003ebeta=5exp((-x+y-60)/20)\u003c/p\u003e\u003cp\u003eresult=alpha+beta;\u003c/p\u003e","function_template":"function z = your_fcn_name(x,y)\r\n  z = x+y;\r\nend","test_suite":"%%\r\nx = 1;\r\ny = 1;\r\nbeta=5.*exp((-x+y-60)/20);\r\nalpha=0.1.*(-x-y-50)./(exp((-x-y-50)/10)-1);\r\ny_correct = alpha+beta;\r\nassert(isequal(your_fcn_name(x,y),y_correct))\r\n%%\r\nx = 1:10;\r\ny = 1:10;\r\nbeta=5.*exp((-x+y-60)/20);\r\nalpha=0.1.*(-x-y-50)./(exp((-x-y-50)/10)-1);\r\ny_correct = alpha+beta;\r\nassert(isequal(your_fcn_name(x,y),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":90467,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":94,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-11T09:22:33.000Z","updated_at":"2026-03-31T10:24:37.000Z","published_at":"2016-10-11T09:22:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolve given expression.\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\u003ealpha=0.1(-x-y-50)/(exp((-x-y-50)/10)-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\u003ebeta=5exp((-x+y-60)/20)\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\u003eresult=alpha+beta;\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":43747,"title":"Find the distance traveled by a car given velocity and time.","description":"A car is traveling at a constant velocity for a specific amount of time. The function should use the two inputs, velocity and time, to find the distance traveled.","description_html":"\u003cp\u003eA car is traveling at a constant velocity for a specific amount of time. The function should use the two inputs, velocity and time, to find the distance traveled.\u003c/p\u003e","function_template":"function y = distance(velocity,time)\r\n  D = time;\r\nend","test_suite":"%%\r\nvelocity = 10;\r\ntime = 60; \r\nD_correct = 600;\r\nassert(isequal(distance(velocity,time),D_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":100857,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":130,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-12-07T20:05:40.000Z","updated_at":"2026-02-10T21:28:41.000Z","published_at":"2016-12-07T20:05:40.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\u003eA car is traveling at a constant velocity for a specific amount of time. The function should use the two inputs, velocity and time, to find the distance traveled.\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":43326,"title":"Solve expression I","description":"Solve expression (1+sin(x))/cos(x)+cos(x)/(1+sin(x)) for given vector x.","description_html":"\u003cp\u003eSolve expression (1+sin(x))/cos(x)+cos(x)/(1+sin(x)) for given vector x.\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = [2     -3     4];\r\ny_correct =  (1.+sin(x))./cos(x)+cos(x)/(1.+sin(x));\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n%%\r\nx = 1:3:100;\r\ny_correct =  (1.+sin(x))./cos(x)+cos(x)/(1.+sin(x));\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":4,"created_by":90467,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":101,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-11T09:03:10.000Z","updated_at":"2026-03-16T01:33:02.000Z","published_at":"2016-10-11T09:03:10.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSolve expression (1+sin(x))/cos(x)+cos(x)/(1+sin(x)) for given vector x.\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":43617,"title":"Calculate the values of a polynomial.","description":"Calculate the values of a polynomial.Input parameter p - vector of polynomial coefficients, x - matrix of the argument values.\r\n\r\nExample \r\n\r\np=[-1 1]\r\n\r\nx=[1 2;3 4]\r\n\r\nresult=[ 0 -1; -2 -3]","description_html":"\u003cp\u003eCalculate the values of a polynomial.Input parameter p - vector of polynomial coefficients, x - matrix of the argument values.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cp\u003ep=[-1 1]\u003c/p\u003e\u003cp\u003ex=[1 2;3 4]\u003c/p\u003e\u003cp\u003eresult=[ 0 -1; -2 -3]\u003c/p\u003e","function_template":"function y = SolvePoly(p,x)\r\n  y = x;\r\nend","test_suite":"%%\r\np=[-1 1]\r\nx=[1 2;3 4]\r\ny_correct=[ 0 -1; -2 -3]\r\nassert(isequal(SolvePoly(p,x),y_correct))\r\n%%\r\np=[-2     0     1    -1     3     2]\r\nx=[5 6 11; 2 13 7; 4 9 21]\r\ny_correct=[-6133      -15352     -320857;\r\n           -52        -740517    -33297;\r\n           -1986      -117421    -8159317]\r\nassert(isequal(SolvePoly(p,x),y_correct))       ","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":90467,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":87,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-24T22:55:06.000Z","updated_at":"2026-02-25T20:49:54.000Z","published_at":"2016-10-24T22:55: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\u003eCalculate the values of a polynomial.Input parameter p - vector of polynomial coefficients, x - matrix of the argument 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ep=[-1 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\u003ex=[1 2;3 4]\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\u003eresult=[ 0 -1; -2 -3]\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":43737,"title":"Alternative Dimensions","description":"Given a multidimensional matrix, transform the matrix so the dimensions are in the order given by variable ord. For example, given the following matrix:\r\n\r\nm has 3 dimensions\r\n\r\n  m(1,:,:) = all 1s\r\n  m(2,:,:) = all 2s\r\n  m(3,:,:) = all 3s\r\n\r\nAfter the transformation to [3 2 1], the matrix should be:\r\n\r\n  m(:,:,1) = all 1s\r\n  m(:,:,2) = all 2s\r\n  m(:,:,3) = all 3s","description_html":"\u003cp\u003eGiven a multidimensional matrix, transform the matrix so the dimensions are in the order given by variable ord. For example, given the following matrix:\u003c/p\u003e\u003cp\u003em has 3 dimensions\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003em(1,:,:) = all 1s\r\nm(2,:,:) = all 2s\r\nm(3,:,:) = all 3s\r\n\u003c/pre\u003e\u003cp\u003eAfter the transformation to [3 2 1], the matrix should be:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003em(:,:,1) = all 1s\r\nm(:,:,2) = all 2s\r\nm(:,:,3) = all 3s\r\n\u003c/pre\u003e","function_template":"function y = transform(M,ord)\r\n  y = x;\r\nend","test_suite":"%%\r\nM=ones(3,3,3);\r\nM(2,:,:)=2.*M(2,:,:);\r\nM(3,:,:)=3.*M(3,:,:);\r\nord = [3,2,1];\r\nMC = ones(3,3,3);\r\nMC(:,:,2)=2.*MC(:,:,2);\r\nMC(:,:,3)=3.*MC(:,:,3);\r\nassert(isequal(transform(M,ord),MC))\r\n%%\r\nM=rand(1,2,3,4,5,6);\r\nord = [6 1 5 2 4 3];\r\nassert(isequal(size(transform(M,ord)),ord))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":93456,"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":"2016-12-06T23:42:04.000Z","updated_at":"2026-02-19T15:41:13.000Z","published_at":"2016-12-06T23:42:04.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 multidimensional matrix, transform the matrix so the dimensions are in the order given by variable ord. For example, given the following matrix:\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\u003em has 3 dimensions\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[m(1,:,:) = all 1s\\nm(2,:,:) = all 2s\\nm(3,:,:) = all 3s]]\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\u003eAfter the transformation to [3 2 1], the matrix should be:\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[m(:,:,1) = all 1s\\nm(:,:,2) = all 2s\\nm(:,:,3) = all 3s]]\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":43479,"title":"Modulation index","description":"The amplitude of the carrier signal is 2V and the amplitude of the modulating signal is 8V. Find its modulation index.","description_html":"\u003cp\u003eThe amplitude of the carrier signal is 2V and the amplitude of the modulating signal is 8V. Find its modulation index.\u003c/p\u003e","function_template":"function z = your_fcn_name(x,y)\r\n  z = ;\r\nend","test_suite":"%%\r\nx = 8; y=2;\r\nz_correct = 4;\r\nassert(isequal(your_fcn_name(x,y),z_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":87885,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":89,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-11T22:34:12.000Z","updated_at":"2026-02-06T15:38:09.000Z","published_at":"2016-10-11T22:34:12.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe amplitude of the carrier signal is 2V and the amplitude of the modulating signal is 8V. Find its modulation index.\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":44008,"title":"intervals","description":"Write a function that takes an interval from a to b, and divides it into 6 parts.\r\n","description_html":"\u003cp\u003eWrite a function that takes an interval from a to b, and divides it into 6 parts.\u003c/p\u003e","function_template":"function y = split_to_six(a,b)\r\n  y = ...;\r\nend","test_suite":"%%\r\n%%\r\na = 1; b=2;\r\ny_correct = [1 1.2 1.4 1.6 1.8 2];\r\nassert(isequal(split_to_six(a,b),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":110067,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":91,"test_suite_updated_at":"2017-01-17T19:12:24.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-01-17T19:12:09.000Z","updated_at":"2026-03-18T23:45:39.000Z","published_at":"2017-01-17T19:12:24.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes an interval from a to b, and divides it into 6 parts.\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":43298,"title":"Calculate area of sector","description":"A=function(r,seta)\r\n\r\nr is radius of sector, seta is angle of sector, and A is its area. Area of sector A is defined as 0.5*(r^2)*seta;","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=\"\"\u003eA=function(r,seta)\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=\"\"\u003er(m) is radius of sector, seta (radian) is angle of sector, and A (m^2) is its area.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = sectorarea(r,seta)\r\n  y =\r\nend","test_suite":"%%\r\nr=1\r\nseta=pi/2\r\ny_correct = 0.7854;\r\nassert(abs(sectorarea(r,seta)-y_correct)\u003c0.001)\r\n\r\n%%\r\nr=2\r\nseta=pi/2\r\ny_correct = pi;\r\nassert(abs(sectorarea(r,seta)-y_correct)\u003c0.001)\r\n\r\n%%\r\nr=sqrt(2);\r\nseta=pi/3\r\ny_correct = pi/3;\r\nassert(abs(sectorarea(r,seta)-y_correct)\u003c0.001)\r\n\r\n%%\r\nr= 6\r\nseta=pi/6;\r\ny_correct = 3*pi;\r\nassert(abs(sectorarea(r,seta)-y_correct)\u003c0.001)\r\n\r\n%%\r\nr= pi\r\nseta= pi\r\ny_correct = 0.5*pi^3;\r\nassert(abs(sectorarea(r,seta)-y_correct)\u003c0.001)\r\n","published":true,"deleted":false,"likes_count":21,"comments_count":6,"created_by":33533,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3452,"test_suite_updated_at":"2021-02-21T07:46:40.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2016-10-10T09:02:12.000Z","updated_at":"2026-04-03T16:02:03.000Z","published_at":"2016-10-10T09:02:12.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA=function(r,seta)\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\u003er(m) is radius of sector, seta (radian) is angle of sector, and A (m^2) is its area.\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":43301,"title":"Calculate inverse matrix in m by n matrix ","description":"  x=(1:10)'\r\n  y=roundn(2*x+7*rand(size(x)),-1)\r\n\r\na*x=y\r\n\r\nEstimate a using inverse matrix calculation. This is principle of linear regression.","description_html":"\u003cpre class=\"language-matlab\"\u003ex=(1:10)'\r\ny=roundn(2*x+7*rand(size(x)),-1)\r\n\u003c/pre\u003e\u003cp\u003ea*x=y\u003c/p\u003e\u003cp\u003eEstimate a using inverse matrix calculation. This is principle of linear regression.\u003c/p\u003e","function_template":"function a = reginv(x,y)\r\n  a =\r\nend","test_suite":"%%\r\n  x=(1:10)'\r\n  y=3*x\r\n  a=3\r\n\r\nassert(abs(reginv(x,y)-a)\u003c0.001)\r\n\r\n%%\r\n  x=(1:10)'\r\n  y=3*x+2\r\n  a=3.2857\r\n\r\nassert(abs(reginv(x,y)-a)\u003c0.001)\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":2,"created_by":33533,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":89,"test_suite_updated_at":"2018-07-19T15:35:54.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-10T09:36:59.000Z","updated_at":"2026-01-02T15:53:13.000Z","published_at":"2016-10-10T09:36:59.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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[x=(1:10)'\\ny=roundn(2*x+7*rand(size(x)),-1)]]\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*x=y\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\u003eEstimate a using inverse matrix calculation. This is principle of linear regression.\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":43553,"title":"Linear Least Squares (L2 fitting problem )","description":"Given a set of real measurements\r\n\r\n     (x(i), y(i))\r\n\r\nfind a line sol(1)x + sol(2) (more specifically furnish the vector with sol=[sol(1),sol(2)])such that it fits the data (it minimises the 2 norm)\r\n\r\n_Example:_ Input:\r\n\r\n  % INPUT\r\n  x=linspace(0,1,50);\r\n  y=4*x-1+ randn(50,1); % perturbed observations\r\n  % SOLUTION:\r\n  sol=[4,-1]\r\n\r\n*HINT :* This problem can be expressed as a convex optimisation problem:\r\n\r\n  min_{sol} sum(sol(1)*x+sol(2)-y)^2   \r\n\r\n*Suggestion:* use the following code to test your function:\r\n\r\n  plot(x,y,'.') % plot the data\r\n  hold on\r\n  plot(x,sol(1)*x+sol(2))\r\n  legend('measurements', 'L2 fit')","description_html":"\u003cp\u003eGiven a set of real measurements\u003c/p\u003e\u003cpre\u003e     (x(i), y(i))\u003c/pre\u003e\u003cp\u003efind a line sol(1)x + sol(2) (more specifically furnish the vector with sol=[sol(1),sol(2)])such that it fits the data (it minimises the 2 norm)\u003c/p\u003e\u003cp\u003e\u003ci\u003eExample:\u003c/i\u003e Input:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e% INPUT\r\nx=linspace(0,1,50);\r\ny=4*x-1+ randn(50,1); % perturbed observations\r\n% SOLUTION:\r\nsol=[4,-1]\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eHINT :\u003c/b\u003e This problem can be expressed as a convex optimisation problem:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003emin_{sol} sum(sol(1)*x+sol(2)-y)^2   \r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eSuggestion:\u003c/b\u003e use the following code to test your function:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eplot(x,y,'.') % plot the data\r\nhold on\r\nplot(x,sol(1)*x+sol(2))\r\nlegend('measurements', 'L2 fit')\r\n\u003c/pre\u003e","function_template":"function sol = Lls2(x,y) % Linear least squares with 2 norm\r\n  y = sol(1)*x+sol(2);  \r\nend","test_suite":"%%\r\nx=linspace(0,1,50)';\r\ny=4*x-1+ randn(50,1); % perturbed observations\r\nsol = Lls2(x,y)\r\nassert(abs(sum(Lls2(x,y))-4+1)\u003c2)\r\n\r\n\r\n%%\r\nx=linspace(0,1,50)';\r\ny=7*x+45+ randn(50,1); % perturbed observations\r\nsol = Lls2(x,y)\r\nassert(abs(sum(Lls2(x,y))-7-45)\u003c2)","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":85837,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":15,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-14T12:57:52.000Z","updated_at":"2016-10-14T12:57:52.000Z","published_at":"2016-10-14T12:57: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\",\"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 set of real measurements\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[     (x(i), y(i))]]\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\u003efind a line sol(1)x + sol(2) (more specifically furnish the vector with sol=[sol(1),sol(2)])such that it fits the data (it minimises the 2 norm)\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\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Input:\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\\nx=linspace(0,1,50);\\ny=4*x-1+ randn(50,1); % perturbed observations\\n% SOLUTION:\\nsol=[4,-1]]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHINT :\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e This problem can be expressed as a convex optimisation problem:\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[min_{sol} sum(sol(1)*x+sol(2)-y)^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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSuggestion:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e use the following code to test your function:\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[plot(x,y,'.') % plot the data\\nhold on\\nplot(x,sol(1)*x+sol(2))\\nlegend('measurements', 'L2 fit')]]\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\"}]}"}],"term":"tag:\"review\"","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:\"review\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"review\"","","\"","review","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f74d98169b0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f74d9816910\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f74d9816050\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f74d9816c30\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f74d9816b90\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f74d9816af0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f74d9816a50\u003e":"tag:\"review\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f74d9816a50\u003e":"tag:\"review\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"review\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"review\"","","\"","review","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f74d98169b0\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f74d9816910\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f74d9816050\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f74d9816c30\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f74d9816b90\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f74d9816af0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f74d9816a50\u003e":"tag:\"review\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f74d9816a50\u003e":"tag:\"review\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":43330,"difficulty_rating":"easy"},{"id":43687,"difficulty_rating":"easy"},{"id":43551,"difficulty_rating":"easy"},{"id":43329,"difficulty_rating":"easy"},{"id":43747,"difficulty_rating":"easy"},{"id":43326,"difficulty_rating":"easy"},{"id":43617,"difficulty_rating":"easy"},{"id":43737,"difficulty_rating":"easy"},{"id":43479,"difficulty_rating":"easy"},{"id":44008,"difficulty_rating":"easy"},{"id":43298,"difficulty_rating":"easy-medium"},{"id":43301,"difficulty_rating":"easy-medium"},{"id":43553,"difficulty_rating":"easy-medium"}]}}