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

4 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.
what is coefficient matrix？I can't understand the meaning of the question
Solution Comments

1 Comment
Simple problem on array denomination

1 Comment
The only big problem is that half of the question was not rendered. That is a problem with the web page itself not the question (fix for firefox).

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
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 Solvers8457
Suggested Problems

1486 Solvers

510 Solvers

Basics: 'Find the eigenvalues of given matrix
385 Solvers

4277 Solvers

4482 Solvers
More from this Author13
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!