Notes
Notes - notes.io |
>> measles1931 = measles(1,:)
measles1931 =
Columns 1 through 8
750 2010 4858 6172 7095 4238 907 165
Columns 9 through 12
43 54 93 134
>> measles1941 = measles(11,:);
>> measlesMay = measles(:,5);
>> measlesSpring = measles(:,[3,4,5]);
>> plot(measles1931)
>> xlabel('Month')
>> ylabel('Cases')
>> title('Measles cases in NYC: 1931')
>> plot(measles1931)
xlabel('Month')
ylabel('Cases')
title('Measles cases in NYC: 1931')
>> figure
>> plot(measles1931 ./ 1000)
>> xlabel('Month')
ylabel('Cases(in thousands)')
title('Measles cases in NYC: 1931')
>> figure
>> plot(years, measlesMay ./1000)
>> xlabel('year')
>> ylabel('Cases(in thousands)')
>> title('Measles cases in NYC: May (1931-1971)')
>> figure
>> hold on
>> plot(measles1931 ./ 1000, '-sb')
>> plot(measles1941 ./ 1000, '-ok')
>> hold off
>> xlabel('Month')
>> ylabel('Cases(in thousands)')
>> title('Measles cases NYC')
>> legend('1931','1941')
>> A= [1 2 6;4 -7 0]
A =
1 2 6
4 -7 0
>> SUM(A,1)
Undefined function 'SUM' for input arguments of type 'double'.
Did you mean:
>> sum(A,1)
ans =
5 -5 6
>> sum(A,2)
ans =
9
-3
>> sum(A(:))
ans =
6
>> sum(A)
ans =
5 -5 6
>> B=[1 2 3];
>> sum(B)
ans =
6
>> load('NYCDiseases.mat')
>> measlesByMonth = sum (measles,1);
>> measlesByYear = sum (measles,2);
>> measlesTotal = sum (measles(:))
measlesTotal =
697948
>> measlesByYear
measlesByYear =
26519
10354
36216
5015
28490
36548
12091
34604
3653
10496
79646
2261
23627
26048
1870
22408
7915
28960
5467
21990
9609
34615
5117
41037
9712
21646
10226
28272
5217
25523
4796
29671
7406
15435
4127
8381
529
2445
5033
1154
3819
>> measlesByMonth
measlesByMonth =
Columns 1 through 7
38556 74472 140556 158060 129549 86122 28541
Columns 8 through 12
7880 3283 4135 7953 18841
>> figure
>> hold on
>> plot(measlesByMonth ./1000, '-rs')
>> ,
>> plot(sum(mumps)./1000, '-ko')
>> hold off
>> A
A =
1 2 6
4 -7 0
>> A(:)
ans =
1
4
2
-7
6
0
>> A
A =
1 2 6
4 -7 0
>> max(A)
ans =
4 2 6
>> max(A, [], 1)
ans =
4 2 6
>> max(A, [], 2)
ans =
6
4
>> min(A, [], 2)
ans =
1
-7
>> min(A, [], 1)
ans =
1 -7 0
>> min(A)
ans =
1 -7 0
>> min(A, 1)
ans =
1 1 1
1 -7 0
>> min(A)
ans =
1 -7 0
>> A
A =
1 2 6
4 -7 0
>> mean(A,2)
ans =
3
-1
>> mean(A,1)
ans =
2.5000 -2.5000 3.0000
>> mean(A)
ans =
2.5000 -2.5000 3.0000
>> median(A,1)
ans =
2.5000 -2.5000 3.0000
>> median(A)
ans =
2.5000 -2.5000 3.0000
>> median(A,2)
ans =
2
0
>> std(A,2)
Error using var (line 95)
W must be a vector of nonnegative weights, or a scalar 0 or 1.
Error in std (line 32)
y = sqrt(var(varargin{:}));
>> std(A,1)
ans =
1.5000 4.5000 3.0000
>> std(A,0,1)
ans =
2.1213 6.3640 4.2426
>> std(A,1,1)
ans =
1.5000 4.5000 3.0000
>> help median
median Median value.
For vectors, median(a) is the median value of the elements in a.
For matrices, median(A) is a row vector containing the median
value of each column. For N-D arrays, median(A) is the median
value of the elements along the first non-singleton dimension
of A.
median(A,DIM) takes the median along the dimension DIM of A.
Example: If A = [1 2 4 4; 3 4 6 6; 5 6 8 8; 5 6 8 8];
then median(A) is [4 5 7 7] and median(A,2)
is [3 5 7 7].'
Class support for input A:
float: double, single
integer: uint8, int8, uint16, int16, uint32, int32, uint64, int64
See also mean, std, min, max, var, cov, mode.
Overloaded methods:
ProbDistUnivParam/median
ProbDistUnivKernel/median
timeseries/median
Reference page in Help browser
doc median
>> load('NYCDiseases.mat')
>> measlesAverage= mean(measles(:));
>> measlesAverage
measlesAverage =
1.4186e+03
>> fprintf('Average measles cases =%g n', measlesAverage);
Average measles cases =1418.59
>> fprintf('Average measles cases =%g', measlesAverage);
Average measles cases =1418.59>>
>> fprintf('Measles: median = %g (max = %g and min = %g) n',...
median(measles(:)), max(measles(:)), min(measles(:)));
Measles: median = 359.5 (max = 25826 and min = 11)
>> fprintf('Measles: median = %8.1f (max = %10.3f and min = %g) n',...
median(measles(:)), max(measles(:)), min(measles(:)));
Measles: median = 359.5 (max = 25826.000 and min = 11)
>>
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team