Surely I shouldn't done this ugly string thing, that is bad for everyone. Without any doubt, Tim's solution is the best one
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
n = 5;
y_correct = -0.467800202134647;
assert( abs(your_fcn_name(n)-y_correct) < .0001)
|
2 | Pass |
n = 50;
y_correct = -2.151544927902936 - 0.430301217000093i
assert( abs(your_fcn_name(n)-y_correct) < .0001)
y_correct =
-2.1515 - 0.4303i
|
3 | Pass |
n = 7;
y_correct = -0.435928596902380
assert( abs(your_fcn_name(n)-y_correct) < .0001)
y_correct =
-0.4359
|
4 | Pass |
n = 70;
y_correct = -3.031653804728051 - 0.430301217000095i
assert( abs(your_fcn_name(n)-y_correct) < .0001)
y_correct =
-3.0317 - 0.4303i
|
1836 Solvers
Make one big string out of two smaller strings
1149 Solvers
267 Solvers
Determine if input is a perfect number
145 Solvers
489 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!