Find the inner product of two vectors.
I think it would be helpful if you specified whether the vectors are row vectors, column vectors, or whether they can be an arbitrary mixture. The test suite only has row vectors, but this makes it rather trivial.
If the x and y vectors could be row and column vectors, then bsxfun(@times, x, y) does a better job
Test set should include some column vectors.
if you make the example-function "y = fcn(x,y)
z = x*y", please make sure matlab at least handles it; "z = fcn(x,y)
z = x*y" would be preferred =)
This function already exists, look up the dot function
In the given code snippet, make some changes to correct the function definition. (The first line)
is the problem is correct? do we take output y or z?
LOL @y set as the output. I was nearly convinced this problem was invalid.
change the output variable to be z
I'm a bit confused. The code outputs the correct answers for the test suite, but it seems I do not pass while submitting.
answer is in terms of z but function give answer in terms of y again confused and give error for simple problem
Nice little bug in there.
This user (mohamed elbesealy) appears to have gamed the system, with fraudulent "likes" of this unremarkable solution submitted by 'sock-puppet' accounts. —DIV
This is correct. What am I missing?
Why is this smaller than just x*y'?
NOt just that, his output is y instead of z!! jajaj...
That is the matrix attribute!
i wrote solution like below
z = sum(x.*y);
it is working on my laptop but in cody show incorrect tell me why
Hmmm, description is a little confusing. Is length(x) always = length(y)? Are they nx1 or 1xn? Anyhow, I submitted several possible solutions (e.g. z = x'*y, z = sum(x.*y)) all of which failed the test suite ... but they work fine on my machine!
Note that the output variable in the pattern is y, not z.
ha, yeah. thanks for commenting about that. I didn't see it either.
Find the sum of all the numbers of the input vector
Determine whether a vector is monotonically increasing
It dseon't mettar waht oedrr the lrettes in a wrod are.
Replicate elements in vectors
Distance walked 1D
swap sign sum & multiply castles
Least common multiple of many numbers
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