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;
Function size = 12
function y = plus_one(x)
z = x;
y = z+1;
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
Determine Whether an array is empty
Matlab Basics - Convert a row vector to a column vector
Find MPG of Lightest Cars
Crop an Image
Calculate a Damped Sinusoid
Plot Line Specifications
Verify Law of Large Numbers
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office