your functions are not all truly 'vectorized'; I would change @(x)1 to @(x)ones(size(x)) for a more consistent 'vectorized' behavior...
Yup, you're right. I made the adjustment...
not meaning to be picky, but in the third test you might want to use aref.' instead of aref' (if x take negative values, which occurs at random for this test, then log(x) takes complex values, and the aref' portion takes the conjugate of the complex valued results); perhaps it is simpler to make sure x takes only positive values...
and nice problem, by the way!
Thanks! Nice catch, I fixed that second issue too (those randomized tests have their drawbacks)
Who Has the Most Change?
Remove the small words from a list of words.
Getting the indices from a vector
Max index of 3D array
kmph to mps
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