Statistics and Trigonometry: Student Weights and Cosine Function
Classified in Computers
Written on in English with a size of 1.9 KB
Weight of 30 Students - Minimum, Maximum, Average and Standard Deviation - Histogram
a = [71 82 65 75 77 91 59 84 89 81 73 91 82 75 96 85 69 76 81 92 84 79 77 95 81 79 84 85 76 82]
a = Columns 1 through 12
71 82 65 75 77 91 59 84 89 81 73 91
Columns 13 through 24
82 75 96 85 69 76 81 92 84 79 77 95
Columns 25 through 30
81 79 84 85 76 82
Maximum: 96
Minimum: 59
Average: 80.5333
Standard Deviation: 8.4516
Histogram
Plot the value of the cosine within [0 2π] with a step of π/20.
Label the axes and add a title.
Add to that graph the sine function. Use hold command.
Place legends to distinguish both graphic
x = 0:pi/20:2*pi
0 0.1571 0.3142 0.4712 0.6283 0.7854 0.9425 1.0996 1.2566
1.4137 1.5708 1.7279 1.8850 2.0420 2.1991 2.3562 2.5133 2.6704
2.8274 2.9845 3.1416 3.2987 3.4558 3.6128 3.7699 3.9270 4.0841
4.2412 4.3982 4.5553 4.7124 4.8695 5.0265 5.1836 5.3407 5.4978
5.6549 5.8119 5.9690 6.1261 6.2832
y = cos(x)
1.0000 0.9877 0.9511 0.8910 0.8090 0.7071 0.5878 0.4540 0.3090
0.1564 0.0000 -0.1564 -0.3090 -0.4540 -0.5878 -0.7071 -0.8090 -0.8910
-0.9511 -0.9877 -1.0000 -0.9877 -0.9511 -0.8910 -0.8090 -0.7071 -0.5878
-0.4540 -0.3090 -0.1564 -0.0000 0.1564 0.3090 0.4540 0.5878 0.7071
0.8090 0.8910 0.9511 0.9877 1.0000
Plot(x, y)
xlabel('x')
ylabel('cos(x)')
title('Cosine of x')
hold
Current plot held
z = sin(x)
0 0.1564 0.3090 0.4540 0.5878 0.7071 0.8090 0.8910 0.9511
0.9877 1.0000 0.9877 0.9511 0.8910 0.8090 0.7071 0.5878 0.4540
0.3090 0.1564 0.0000 -0.1564 -0.3090 -0.4540 -0.5878 -0.7071 -0.8090
-0.8910 -0.9511 -0.9877 -1.0000 -0.9877 -0.9511 -0.8910 -0.8090 -0.7071
-0.5878 -0.4540 -0.3090 -0.1564 -0.0000
Plot(x, z)
legend('cos(x)', 'sin(x)')
ylabel('y')