MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodaySearch Activities

Paul Berglund submitted a Comment to Solution 502532

You're right, it should fail. I've added your example to the test suite.

4 hours and 30 minutes ago

Gergely Patay submitted a Comment to Problem 625. Determine Whether an array is empty

This is just lame, and without a proper test case.

14 hours and 53 minutes ago

Paul Berglund submitted a Comment to Solution 548104

I too stole Tim's rotation code...

15 hours and 56 minutes ago

Grant submitted a Comment to Problem 2781. Rule of mixtures (composites) - reverse engineering

It was definitely not my tag; fortunately it disappeared. Thanks for commenting on it though, as you are right; apparently you influenced the offender to take it down.

on 18 Dec 2014 at 12:42

Jan Orwat submitted a Comment to Problem 2781. Rule of mixtures (composites) - reverse engineering

I meant, that writing such tags like the one mentioned above doesn't explain anything to anyone, but may be offending. I think it is a good practice to say what we enjoy or dislike via comments and let others to discuss it. (I assume it was not your tag, Grant). Anyway, it disappeared

on 17 Dec 2014 at 9:05

Grant submitted a Comment to Problem 2781. Rule of mixtures (composites) - reverse engineering

I don't quite understand your second comment regarding the tag. Could you elucidate what you intended?

on 16 Dec 2014 at 23:29

Grant submitted a Comment to Problem 2781. Rule of mixtures (composites) - reverse engineering

Jan, I've revised the explanation for this problem to be clearer. I understand the confusion, as this is one of many different ways to slice such problems. This problem is specifically asking for extrapolated values of Em using both bound equations and then using the (provided) equally spaced weightings to determine equally spaced modulus estimates. Realistically, such a problem would likely implement statistical distributions, rather than evenly spaced weightings, but I didn't want to make the problem too difficult. Also, I've revised the precision for this and the other problems to be much tighter.

on 16 Dec 2014 at 23:28

Matthew Brown submitted a Comment to Problem 1. Times 2 - START HERE

I did in fact start here.

on 16 Dec 2014 at 15:54

Gergely Patay submitted a Comment to Solution 546456

I'm not proud of this solution, the scoring system is clearly flawed.

on 16 Dec 2014 at 13:20

Jan Orwat submitted a Comment to Problem 2781. Rule of mixtures (composites) - reverse engineering

I would also like to comment on the tag "THESE_ARE_JUST_PATHETIC". I don't know who has written this, I don't care. I just feel it inappropriate.

on 16 Dec 2014 at 11:10

Jan Orwat submitted a Comment to Problem 2781. Rule of mixtures (composites) - reverse engineering

Grant, in the test suite you expect the answer (Em) to be linearly spaced while it is not. for example, in first test wt=0.5 you check for Em=17.7193 which gives Ec=32.9652. Correct answer is closer to Em=20.25 (when wt=0.5) based on equations you provide. Also, do you really want so small precision? 10e-1 equals 1.

on 16 Dec 2014 at 10:29

Eloy submitted a Comment to Solution 545945

function matchFound=StudentCode(x,y,z)
matchFound = true;
... is valid?

on 14 Dec 2014 at 20:12

rifat ahmed submitted a Comment to Problem 1672. Leftovers? Again?!

Chinese remainder theorem
http://en.wikipedia.org/wiki/Chinese_remainder_theorem

on 14 Dec 2014 at 11:58

Andrew Newell submitted a Comment to Problem 2553. Complex number

This is just adding two numbers together - nothing to do with complex numbers, really.

on 13 Dec 2014 at 21:44

Andrew Newell submitted a Comment to Problem 1516. Put m balls into n boxes

Thanks - and I realize now that 1 1 2 is not excluded; I just wasn't looking carefully.

on 11 Dec 2014 at 23:47

Jonathan submitted a Comment to Problem 1168. Return 'on' or 'off'

The problem statement is misleading. 'if x' and 'if isequal(x, true)' are different conditions.

on 11 Dec 2014 at 17:23

Binbin Qi submitted a Comment to Problem 1516. Put m balls into n boxes

the data ascended by column,when the first column is the same, sort by the second column,...

on 11 Dec 2014 at 1:40

Andrew Newell submitted a Comment to Problem 1516. Put m balls into n boxes

I don't think you have a complete statement of the problem. Why, in the first example, are arrangements like 1 1 2 excluded? And you only accept the arrangements in a particular order. How do you define the order?

on 10 Dec 2014 at 1:35

Andrew Newell submitted a Comment to Solution 319017

This one really surprised me.

on 9 Dec 2014 at 23:24

rifat ahmed submitted a Comment to Problem 2765. Column arrays: Transpose a row array

I don't want to be pedantic and boring. But most of your problems are already available in Cody. If your intention is to teach students or create a MATLAB tutorial, you should look for those problems first in Cody and then add Tags to them. Getting a transpose, concatenation of strings... these questions have been asked hundred times in Cody.

on 9 Dec 2014 at 6:10

Andrew Newell submitted a Comment to Solution 303496

I agree; not accounting for imprecision is bad numerical practice.

on 6 Dec 2014 at 2:32

Jan Orwat submitted a Comment to Problem 2313. Narcissistic problem

Oh, right it's not html. Andrew, thanks for pointing that out, my bad.

on 5 Dec 2014 at 16:33

B. C. submitted a Comment to Solution 541155

fail for x=120?! 'isequal(factorial(120),y)' gives me 0...

on 5 Dec 2014 at 13:22

Guillaume submitted a Comment to Problem 2703. Form a gaussian kernel using matrix size and sigma value

What is the definition of this gaussian kernel? And why is it just integers? Note that matlab's imaging toolbox already have this function fspecial('gaussian', 3, 1.2) which returns a vastly different kernel

on 5 Dec 2014 at 8:24

Andrew Newell submitted a Comment to Problem 1052. Elapsed time is -0.005204 seconds.

The behavior of the test environment is strange. It doesn't accept syntaxes like
function superfast
...
which my 2014a MATLAB has no problems with. I had to use
y = superfast(x)
even though there is no input or output.

on 5 Dec 2014 at 0:06

Andrew Newell submitted a Comment to Problem 2313. Narcissistic problem

In the test code, did you really mean (/d*) and not (\d*) ?

on 4 Dec 2014 at 23:14

Ned Gulley submitted a Comment to Solution 540224

Done. Thanks for the comment!

on 4 Dec 2014 at 15:58

Jan Orwat submitted a Comment to Solution 540224

minor bug there. crashes for vectors and return incorrect answers for some input, for example a_in=[0 1 1 1; 0 0 0 0], a_out=[1 1 0 1; 0 0 0 0] instead of a_correct=[1 0 1 1; 0 0 0 0]. Ned, could you extend the test suite to 'kill' this answer?

on 4 Dec 2014 at 11:43

Stephen submitted a Comment to Solution 540022

nice, I wish I had thought of it this way

on 4 Dec 2014 at 2:10

Gareth Lee submitted a Comment to Problem 87. Indexed Probability Table

Is it not permitted by using tabulate function to solve it?

on 2 Dec 2014 at 10:22

Paul Berglund submitted a Comment to Problem 2697. Probability of winning single-elimination tournament

OK, I made it consistently use NaN.

on 2 Dec 2014 at 2:09

J.R.! Menzinger submitted a Comment to Solution 538998

No fucntion call here. :-/

on 1 Dec 2014 at 16:38

J.R.! Menzinger submitted a Comment to Solution 538996

please add more test cases.

on 1 Dec 2014 at 16:35

Jon submitted a Comment to Problem 2697. Probability of winning single-elimination tournament

Could you make your test cases consistent on using either 0 or NaN on the diagonal?

on 1 Dec 2014 at 14:55

rifat ahmed submitted a Comment to Solution 537233

Sorry... I misread the definition. I thought it was only the main diagonal. I will submit another solution. Anyway.. your test suite should contain matrices to prevent such cases.

on 1 Dec 2014 at 9:22

VIVEK RUHELA submitted a Comment to Solution 537233

Well Mr. Rifat, this is nice coding but does not fulfill the purpose. I dont know how did this solution checked as correct. Let me tell you about Toeplitz Matrix. A matrix in which all elements of main diagonal are equal and elements of other sub-diagonals parallel to main diagonal are equal. plz check this eg:a=[2 0 7 8 9;3 2 0 7 8;6 3 2 0 7;4 6 3 2 0;1 4 6 3 2]. Your coding still gives true even for non-toeplitz matrix. I'll check my reference solution again. Thanks for your time.

on 30 Nov 2014 at 6:26

Adam submitted a Comment to Solution 306061

You have to solve additional problems and then come back to look at the solutions here.

on 28 Nov 2014 at 15:51

Jan Orwat submitted a Comment to Problem 2689. vector to string

Luke, you have to modify your testsuite. For now it doesn't check submitted solution, so any solution will pass. You shouldn't use the same name for a function and variable.

on 28 Nov 2014 at 9:29

Guillaume submitted a Comment to Problem 2693. Test if a matrix is symmetric

You need a test case with a non-symmetric matrix. Otherwise, your test suite is too easily defeated.

on 28 Nov 2014 at 8:17

Binbin Qi submitted a Comment to Problem 2470. self description 2.0

use builtin,so I overload all the eq, but failed

on 28 Nov 2014 at 6:26

Binbin Qi submitted a Comment to Problem 2247. Dimensions of Spaces

http://en.wikipedia.org/wiki/Fundamental_theorem_of_linear_algebra

on 27 Nov 2014 at 15:00

Ziko submitted a Comment to Solution 535203

because of rounding errors.
B = round(a1*b1);
it should work in this case as all numbers are integers.

on 27 Nov 2014 at 10:36

Ned Gulley submitted a Comment to Problem 2692. design a magic matrix without using the command magic.

Hi Anumpam: Thanks for the problem. You need to fix the test suite as James says. Also, since you haven't specified what order you want the numbers in, you should probably check to make sure the matrix has magic properties (rows add to the same number, etc.) rather than testing that it matches exactly one matrix. There are lots of magic 4-by-4 matrices.

on 26 Nov 2014 at 14:52