MATLAB FINANCIAL DERIVATIVES TOOLBOX Uživatelský manuál Strana 62

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 119
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 61
61
Matlab’s command:
>> clear; x=-2:1:2; y=-4:1:4; [X,Y]=meshgrid(x,y)
>> plot(X,Y, 'rh'); axis([-3 3 -5 5]); xlabel('x-axis'); ylabel('y-axis');
>> title('Meshgrid');
Matlab’s response:
X =
-2 -1 0 1 2
-2 -1 0 1 2
-2 -1 0 1 2
-2 -1 0 1 2
-2 -1 0 1 2
-2 -1 0 1 2
-2 -1 0 1 2
-2 -1 0 1 2
-2 -1 0 1 2
Y =
-4 -4 -4 -4 -4
-3 -3 -3 -3 -3
-2 -2 -2 -2 -2
-1 -1 -1 -1 -1
0 0 0 0 0
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
-3 -2 -1 0 1 2 3
-5
-4
-3
-2
-1
0
1
2
3
4
5
x-axis
y-axis
Meshgrid
Comments:
Creating the grid neces
sary for plotting a 3D surface.
m
m
e
e
s
s
h
h
g
g
r
r
i
i
d
d
takes as inputs the vectors
x
x and
y
y that define the (x,y)-plane that
should be used to evaluate
Z
Z and returns two matrices (
X
X and
Y
Y)
that if taken together, generate various (x,y) pairs that lay in the
rectangular d
omain. The subsequent 2D plot of
X
X
and
Y
Y
shows
Zobrazit stránku 61
1 2 ... 57 58 59 60 61 62 63 64 65 66 67 ... 118 119

Komentáře k této Příručce

Žádné komentáře