155GIT1 / 7. cvičení: Porovnání verzí

Z GeoWikiCZ
mBez shrnutí editace
Řádek 38: Řádek 38:
x = 1:100;
x = 1:100;
figure
figure
% prvni
% první
subplot(2, 2, 1)
subplot(2, 2, 1)
plot(x, x)
plot(x, x)
% druhy
% druhý
subplot(2, 2, 2)
subplot(2, 2, 2)
plot(x, sqrt(x))
plot(x, sqrt(x))
% treti
% třetí
subplot(2, 2, 3)
subplot(2, 2, 3)
plot(x, log(x))
plot(x, log(x))
% ctvrty
% čtvrtý
subplot(2, 2, 4)
subplot(2, 2, 4)
plot(x, x.^2)
plot(x, x.^2)
</source>
* <code>axis()</code> - omezení oblasti grafu
<source> lang=octave>
x = 0:0.1:5;
y = exp(x);
% celý graf
subplot(2, 1, 1)
plot(x, y)
% výsek x <1,2>; y <0, 10>
subplot(2, 1, 2)
plot(x, y)
axis([1,2,0,10])
</source>
</source>


== Úlohy ==
== Úlohy ==

Verze z 31. 3. 2015, 14:02

Grafy funkcí, uživatelské funkce

Náplň cvičení

  1. grafické okno figure
  2. grafy funkcí plot(), subplot()

Ukázky

Grafické okno

figure

Grafy funkcí

x = [0:pi/100:2*pi];
y = sin(x);
plot(x, y)
%
% nové okno
h = figure
plot(x, y 'r+')
%
% více grafů najednou
z = cos(x);
plot(x, y, 'r+', x, z, 'b*')
  • subplot()
x = 1:100;
figure
% první
subplot(2, 2, 1)
plot(x, x)
% druhý
subplot(2, 2, 2)
plot(x, sqrt(x))
% třetí
subplot(2, 2, 3)
plot(x, log(x))
% čtvrtý
subplot(2, 2, 4)
plot(x, x.^2)
  • axis() - omezení oblasti grafu
 lang=octave>
x = 0:0.1:5;
y = exp(x);
% celý graf
subplot(2, 1, 1)
plot(x, y)
% výsek x <1,2>; y <0, 10>
subplot(2, 1, 2)
plot(x, y)
axis([1,2,0,10])

Úlohy