Problem 2879. Square the input
Given a scalar or vector x, return the square of each element.
Example
x = [7 2] answer = [49 4]
Solution Stats
Problem Comments
-
3 Comments
Zikobrelli
on 27 Jan 2015
There's a problem is test#2.
you should write x and y_correct as vectors / x=[2 3 4] --> y_correct=[4 9 16]
Guillaume
on 27 Jan 2015
When you write your problem, there's a section to actually test your test suite. What not do that before publishing the problem?
Anupam Agarwal
on 28 Jan 2015
Sorry for inconvenience... now i have learnt to create problems...
Solution Comments
Show commentsProblem Recent Solvers486
Suggested Problems
-
277 Solvers
-
1784 Solvers
-
383 Solvers
-
Sum the squares of numbers from 1 to n
248 Solvers
-
Find the max element of the array
1696 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!