Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
filetext = fileread('myCos.m');
assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')
|
2 | Pass |
filetext = fileread('myCos.m');
trigUsed = any(strfind(filetext, 'cos')) || any(strfind(filetext, 'sin')) ||...
any(strfind(filetext, 'exp'));
assert(~trigUsed, 'Cannot use MATLAB trigonometric functions')
|
3 | Pass |
x = 0;
assert(abs(myCos(x)-cos(x)) < 0.0001)
a =
1
a =
0
y =
1
|
4 | Pass |
x = pi;
assert(abs(myCos(x)-cos(x)) < 0.0001)
a =
1
a =
-4.9348
a =
4.0587
a =
-1.3353
a =
0.2353
a =
-0.0258
a =
0.0019
a =
-1.0464e-04
a =
4.3031e-06
y =
-1.0000
|
5 | Pass |
x = pi/2;
assert(abs(myCos(x)-cos(x)) < 0.0001)
a =
1
a =
-1.2337
a =
0.2537
a =
-0.0209
a =
9.1926e-04
a =
-2.5202e-05
y =
-4.6477e-07
|
6 | Pass |
x = 5*pi/3;
assert(abs(myCos(x)-cos(x)) < 0.0001)
a =
1
a =
-13.7078
a =
31.3172
a =
-28.6193
a =
14.0110
a =
-4.2680
a =
0.8864
a =
-0.1335
a =
0.0153
a =
-0.0014
a =
9.8593e-05
y =
0.5000
|
1598 Solvers
1365 Solvers
Number of 1s in the Binary Representation of a Number
356 Solvers
Try 1.5.4: Celsius to Fahrenheit
609 Solvers
Switch matrix to a column vector
260 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!