crcv1
adr_dat1=[crpath,'/brockwel.dat/'];
adr_dat2=[crpath,'/budikova.dat/'];
[x,xinf]=getdata([adr_dat1,'airpass.dat']); pause;
[x,xinf]=getdata([adr_dat1,'uspop.dat']); pause;
[x,xinf]=getdata([adr_dat1,'deaths.dat']); pause;
[x,xinf]=getdata([adr_dat1,'sunspots.dat']); pause;
[x,xinf]=getdata([adr_dat1,'strikes.dat']); pause;
[x,xinf]=getdata([adr_dat1,'appa.dat']); pause;
[x,xinf]=getdata([adr_dat1,'appb.dat']); pause;
[x,xinf]=getdata([adr_dat1,'appc.dat']); pause;
[x,xinf]=getdata([adr_dat1,'appd.dat']); pause;
[x,xinf]=getdata([adr_dat1,'appe.dat']); pause;
[x,xinf]=getdata([adr_dat1,'appf.dat']); pause;
[x,xinf]=getdata([adr_dat1,'appg.dat']); pause;
[x,xinf]=getdata([adr_dat1,'apph.dat']); pause;
[x,xinf]=getdata([adr_dat1,'appi.dat']); pause;
[x,xinf]=getdata([adr_dat1,'appj.dat']); pause;
[x,xinf]=getdata([adr_dat1,'appk.dat']); pause;
[x,xinf]=getdata([adr_dat2,'brno.dat'],[-2,3:15]); pause;
x(1:10,:), pause;
ans =
1.0e+003 *
Columns 1 through 6
1.9160 0.0029 0 0.0073 0.0097 0.0142
1.9170 -0.0023 -0.0050 0.0013 0.0060 0.0152
1.9180 -0.0009 0.0006 0.0048 0.0124 0.0153
1.9190 0.0010 -0.0004 0.0040 0.0074 0.0107
1.9200 0.0016 0.0019 0.0062 0.0126 0.0156
1.9210 0.0033 0.0012 0.0056 0.0090 0.0159
1.9220 -0.0034 -0.0038 0.0046 0.0081 0.0148
1.9230 0.0004 -0.0008 0.0051 0.0077 0.0144
1.9240 -0.0036 -0.0035 0.0024 0.0072 0.0155
1.9250 0.0003 0.0034 0.0024 0.0092 0.0155
Columns 7 through 12
0.0152 0.0183 0.0172 0.0130 0.0083 0.0055
0.0195 0.0196 0.0189 0.0151 0.0090 0.0051
0.0149 0.0180 0.0175 0.0145 0.0097 0.0031
0.0160 0.0165 0.0171 0.0158 0.0075 0.0008
0.0159 0.0193 0.0169 0.0142 0.0063 0.0001
0.0162 0.0201 0.0194 0.0138 0.0103 0.0013
0.0180 0.0191 0.0169 0.0124 0.0065 0.0021
0.0133 0.0194 0.0174 0.0138 0.0108 0.0041
0.0169 0.0183 0.0164 0.0152 0.0090 0.0024
0.0155 0.0184 0.0176 0.0122 0.0084 0.0048
Columns 13 through 14
0.0037 0.0096
-0.0022 0.0084
0.0007 0.0092
0.0002 0.0081
0 0.0092
-0.0008 0.0096
0.0007 0.0080
-0.0010 0.0087
-0.0006 0.0080
-0.0026 0.0088
xinf, pause;
xinf =
MEAN MONTHLY AIR TEMPERATURES 1916-1990, BRNO, CZECH REPUBLIC
year
row DATE I II III IV V VI VII VIII IX X XI XII ROK
plotdata(x(:,1:2),xinf,1); pause; % Vykresleni 2.sloupce vzhledem 1.sloupci
more on
keyboard; % Pro srovnani vypiste soubor pomoci type([adr_dat2,'brno.dat'])
return
more off
[x,xinf]=getdata([adr_dat2,'croatia.dat'],[-1,2:6]); pause;
[x,xinf]=getdata([adr_dat2,'czrep.dat'],[-1,2:32]); pause;
[x,xinf]=getdata([adr_dat2,'misra.dat']); pause;
[x,xinf]=getdata([adr_dat2,'misv.dat']); pause;
[x,xinf]=getdata([adr_dat2,'prmestep.dat'],[-1,2:14]); pause;
[x,xinf]=getdata([adr_dat2,'skplsra.dat']); pause;
[x,xinf]=getdata([adr_dat2,'skplsv.dat']); pause;
[x,xinf]=getdata([adr_dat2,'wienvv.dat'],[-1,2]);
echo off
close all
% Simulovany proces hazeni minci
p=0.5;
n=100;
t=1:n;
help rand
RAND Uniformly distributed pseudo-random numbers.
R = RAND(N) returns an N-by-N matrix containing pseudo-random values
drawn from a uniform distribution on the unit interval. RAND(M,N)
or RAND([M,N]) returns an M-by-N matrix. RAND(M,N,P,...) or
RAND([M,N,P,...]) returns an M-by-N-by-P-by-... array. RAND with
no arguments returns a scalar. RAND(SIZE(A)) returns an array the
same size as A.
You can use any one of three generator algorithms, as follows:
RAND(METHOD,S) causes RAND to use the generator determined by METHOD, and
initializes the state of that generator. S is a scalar integer value from
0 to 2^32-1, or the output of RAND(METHOD). METHOD is one of the
following strings:
'state' - Use a modified version of Marsaglia's Subtract-with-Borrow
algorithm, the default in MATLAB Versions 5 and later. This
method can generate all the double precision values in the
closed interval [2^(-53), 1-2^(-53)], and, theoretically,
can generate over 2^1492 values before repeating itself.
'seed' - Use a multiplicative congruential algorithm, the default
in MATLAB Version 4. This method generates double precision
values in the closed interval [1/(2^31-1), 1-1/(2^31-1)],
with a period of 2^31-2.
'twister' - Use the Mersenne Twister algorithm by Nishimura and
Matsumoto. This method generates double precision values
in the closed interval [2^(-53), 1-2^(-53)], with a period
of (2^19937-1)/2.
RAND(METHOD) returns the current internal state of the generator
determined by METHOD. However, it does not switch generators.
The sequence of numbers produced by RAND is determined by the internal
state of the generator. Setting the generator to the same fixed state
allows computations to be repeated. Setting the generator to different
states leads to unique computations, however, it does not improve any
statistical properties. Since MATLAB resets the state at start-up, RAND
will generate the same sequence of numbers in each session unless the
state is changed.
Note: The size inputs M, N, and P... should be nonnegative integers.
Negative integers are treated as 0.
Examples:
Return RAND to its default initial state.
rand('state',0)
Initialize RAND to a different state each time.
rand('state',sum(100*clock))
Save the current state, generate 100 values, reset the state,
and repeat the sequence.
s = rand('state');
u1 = rand(100);
rand('state',s);
u2 = rand(100); % contains exactly the same values as u1
Generate uniform values from the interval [a, b].
r = a + (b-a).*rand(100,1);
Generate integers uniform on the set 1:n.
r = ceil(n.*rand(100,1));
Use the Mersenne Twister generator, with the default initial state
used by Nishimura and Matsumoto.
rand('twister',5489);
For a full description of the Mersenne Twister algorithm, see
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html.
See also randn, sprand, sprandn, randperm.
Reference page in Help browser
doc rand
y=rand(1,n); % Generovani IID rovnomerne rozlozenych na [0,1]
min(y)
ans =
0.0159
max(y)
ans =
0.9974
x=-(y<=0.5) + (y>0.5); % Binarni proces hazeni minci
plot(x,'o')
help axis
AXIS Control axis scaling and appearance.
AXIS([XMIN XMAX YMIN YMAX]) sets scaling for the x- and y-axes
on the current plot.
AXIS([XMIN XMAX YMIN YMAX ZMIN ZMAX]) sets the scaling for the
x-, y- and z-axes on the current 3-D plot.
AXIS([XMIN XMAX YMIN YMAX ZMIN ZMAX CMIN CMAX]) sets the
scaling for the x-, y-, z-axes and color scaling limits on
the current axis (see CAXIS).
V = AXIS returns a row vector containing the scaling for the
current plot. If the current view is 2-D, V has four
components; if it is 3-D, V has six components.
AXIS AUTO returns the axis scaling to its default, automatic
mode where, for each dimension, 'nice' limits are chosen based
on the extents of all line, surface, patch, and image children.
AXIS MANUAL freezes the scaling at the current limits, so that if
HOLD is turned on, subsequent plots will use the same limits.
AXIS TIGHT sets the axis limits to the range of the data.
AXIS FILL sets the axis limits and PlotBoxAspectRatio so that
the axis fills the position rectangle. This option only has
an effect if PlotBoxAspectRatioMode or DataAspectRatioMode are
manual.
AXIS IJ puts MATLAB into its "matrix" axes mode. The coordinate
system origin is at the upper left corner. The i axis is
vertical and is numbered from top to bottom. The j axis is
horizontal and is numbered from left to right.
AXIS XY puts MATLAB into its default "Cartesian" axes mode. The
coordinate system origin is at the lower left corner. The x
axis is horizontal and is numbered from left to right. The y
axis is vertical and is numbered from bottom to top.
AXIS EQUAL sets the aspect ratio so that equal tick mark
increments on the x-,y- and z-axis are equal in size. This
makes SPHERE(25) look like a sphere, instead of an ellipsoid.
AXIS IMAGE is the same as AXIS EQUAL except that the plot
box fits tightly around the data.
AXIS SQUARE makes the current axis box square in size.
AXIS NORMAL restores the current axis box to full size and
removes any restrictions on the scaling of the units.
This undoes the effects of AXIS SQUARE and AXIS EQUAL.
AXIS VIS3D freezes aspect ratio properties to enable rotation of
3-D objects and overrides stretch-to-fill.
AXIS OFF turns off all axis labeling, tick marks and background.
AXIS ON turns axis labeling, tick marks and background back on.
AXIS(H,...) changes the axes handles listed in vector H.
See also axes, grid, subplot, xlim, ylim, zlim.
Reference page in Help browser
doc axis
axis([0,100,-2,2])
p=0.75
p =
0.7500
x=-(y<=0.75) + (y>0.25); % Binarni proces hazeni nevyvazenou minci
plot(x,'o')
axis([0,100,-2,2])
sum(x==-1)
ans =
26
x=-(y<=p) + (y>p); % Binarni proces hazeni minci
sum(x==-1)
ans =
79
plot(x,'o')
axis([0,100,-2,2])
% Generovani nahodne prochazky
X=x'*ones(1,n);
X(1:5,1:5)
ans =
-1 -1 -1 -1 -1
-1 -1 -1 -1 -1
1 1 1 1 1
-1 -1 -1 -1 -1
-1 -1 -1 -1 -1
XT=triu(X);
XT(1:5,1:5)
ans =
-1 -1 -1 -1 -1
0 -1 -1 -1 -1
0 0 1 1 1
0 0 0 -1 -1
0 0 0 0 -1
S=sum(XT);
S(1:10)
ans =
-1 -2 -1 -2 -3 -4 -5 -6 -7 -6
plot(S) % Nahodna prochazka generovana hazenim nevyvazenou mnci
% Nahodna prochazka generovana hazenim vyvazenou mnci
p=0.5;
x=-(y<=p) + (y>p); % Binarni proces hazeni minci
S=sum(triu(x'*ones(1,n)));
plot(S)
diary off