can anyone please help me to find out the where is the mistake, i am a new learner .........
You have to define a function vecsum() like:
function y = vecsum(x)
y=0;
for x= 0:1:10
y=x+y;
end
end
because your answer is executed by calling function in test suite below. The function's name is decided by problem creater.
What is your code Sir?
If you write your code here, I can say where is the mistake.
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
x = 1;
y_correct = 1;
assert(isequal(vecsum(x),y_correct))
|
2 | Fail |
x = [1 2 3 5];
y_correct = 11;
assert(isequal(vecsum(x),y_correct))
|
3 | Fail |
x = [1 2 3 5];
y_correct = 11;
assert(isequal(vecsum(x),y_correct))
|
4 | Fail |
x = 1:100;
y_correct = 5050;
assert(isequal(vecsum(x),y_correct))
|
1424 Solvers
725 Solvers
405 Solvers
260 Solvers
Check that number is whole number
1070 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!