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)
counter =
0
|
4 | Pass |
x = pi;
assert(abs(myCos(x)-cos(x)) < 0.0001)
counter =
-4.9348
counter =
4.0587
counter =
-1.3353
counter =
0.2353
counter =
-0.0258
counter =
0.0019
counter =
-1.0464e-04
counter =
4.3031e-06
|
5 | Pass |
x = pi/2;
assert(abs(myCos(x)-cos(x)) < 0.0001)
counter =
-1.2337
counter =
0.2537
counter =
-0.0209
counter =
9.1926e-04
counter =
-2.5202e-05
|
6 | Pass |
x = 5*pi/3;
assert(abs(myCos(x)-cos(x)) < 0.0001)
counter =
-13.7078
counter =
31.3172
counter =
-28.6193
counter =
14.0110
counter =
-4.2680
counter =
0.8864
counter =
-0.1335
counter =
0.0153
counter =
-0.0014
counter =
9.8593e-05
|
Program an exclusive OR operation with logical operators
639 Solvers
What is the distance from point P(x,y) to the line Ax + By + C = 0?
278 Solvers
Find out missing number from a vector of 9 elements
245 Solvers
367 Solvers
270 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!