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.
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.
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 node-count 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.
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
how tf do u do this
whats wrong with this problem, it runs perfectly on my matlab.
Developers guys, you should fix this problem
Good job!!!
lol
Find relatively common elements in matrix rows
1018 Solvers
Remove the polynomials that have positive real elements of their roots.
787 Solvers
Make an awesome ramp for a tiny motorcycle stuntman
371 Solvers
659 Solvers
463 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!