Problem 44946. Solve a System of Linear Equations
Solution Stats
Problem Comments

3 Comments
The problem statement clearly states to use mldivide (\)
How can the leading solution be cos(theta)+sin(theta)*[1;1]
My code is working perfectly on my desktop Matlab version, but here it's not accepting and displaying as incorrect..anyone help me out!
The syms function is in a toolbox—Cody does not currently support any toolbox functions.
Solution Comments

1 Comment
not hard

1 Comment
good use of A/b

4 Comments
Your last solution is false.
I had to use a trick to get a pass.
it's [0.3982; 1.357] and not [1.357;0.3982]!!
The last test case is correct...
Your solution has the sin() and +sin() flipped.
Good problem

3 Comments
Does anyone know how the 'size' value is calculated? Is it related to the # of lines of code, or the complexity? Does anyone have any tips regarding how to reduce size? I keep writing high 'size' code...
"Cody uses a nodecount calculation to determine the solution size based on the number of nodes in the parse tree. Think of size as code length."  via the Official Cody homepage.
You can reduce size by reducing no. of operations as well as no. of variables.
function y = plus_one(x)
y = x+1;
end
Function size = 12
function y = plus_one(x)
z = x;
y = z+1;
end
Function size = 16
For an example related to this question, instead of defining b, you can do x = A\[1;1].
You can also take a look on other user's solutions to get some more idea.
However, in the long run that is not the best practice you would want to learn. As we write complex code, defining variables clearly and explicitly helps understand the code better. I would say what you have done is a good example of a clean code.
That is a very helpful comment, @Dyuman Joshi.

1 Comment
How is the size of this solution 10?

1 Comment
What is this? I don't even understand the question?
The answer is:
A=[cos(theta) sin(theta); sin(theta) cos(theta)]; % coefficients of X1 and X2
b=[1;1] % It is a column vector

1 Comment
how tf do u do this

1 Comment
whats wrong with this problem, it runs perfectly on my matlab.
Developers guys, you should fix this problem

1 Comment
Good job!!!

1 Comment
lol
Problem Recent Solvers6098
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!