Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Одиноков / МиИПиС_асп_13г / MATLAB R2008a. КЛАССЫ_ЧАСТЬ 4_12г.doc
Скачиваний:
27
Добавлен:
15.04.2015
Размер:
735.74 Кб
Скачать

Оглавление

ВВЕДЕНИЕ..........................................................................................................3

Implementing a Class for Polynomials(Исполнение класса полиномов).........................................................................4

Example — A Polynomial Class(Пример – класс полиномов)..........................................................................................4

Adding a Polynomial Object to the MATLAB Language (Добавление полином-объекта к языку MATLAB)...................................................................................5

Displaying the Class Files (Отображение файлов класса)....................................................................................................5

Summary of the DocPolynom Class (Резюме класса DocPolynom)...........................................................................5

Using the DocPolynom Class (Использование класса DocPolynom)...................................................................7

The DocPolynom Constructor Method (DocPolynom-конструктор-метод).......................................................8

Constructor Calling Syntax (Синтаксис вызова конструктора)................................................................................8

Converting DocPolynom Objects to Other Types (Конвертирование DocPolynom-объектов к другим типам).......................................................................................9

The DocPolynom to Double Converter (Конвертор DocPolynom - double).....................................9

The DocPolynom to Character Converter (Конвертор DocPolynom - char).......................................10

Evaluating the Output (Оценка вывода)..................11

The DocPolynom disp Method (DocPolynom- disp-метод)...........................................................................................12

When MATLAB Calls the disp Method (Когда MATLAB вызывает disp-метод)................................................13

The DocPolynom subsref Method (DocPolynom- subsref- метод)............................................................13

subsref Implementation Details (Детали исполнения subsref)...............................................................14

Defining Arithmetic Operators for DocPolynom (Определение арифметических операторов для DocPolynom)..............................................................................15

Defining the + Operator (Определение

оператора «+»).............................................................................16

Defining the – Operator (Определение

оператора «-»)..............................................................................17

Defining the * Operator(Определение

оператора «*»).............................................................................17

Using the Arithmetic Operators(Использование арифметических операторов)....................................................18

Overloading MATLAB Functions for the DocPolynom Class(ПереопределениеMATLAB- функций для классаDocPolynom)..................................................18

Defining the roots Function for the DocPolynom Class (Определение функции roots для класса DocPolynom)..................................................19

Defining the polyval Function for the DocPolynom Class (Определение функции polyval для класса DocPolynom)..........................................................19

Defining the diff Function for the DocPolynom Class (Определение функции diff для класса DocPolynom).................................................................20

Defining the plot Function for the DocPolynom Class (Определение функции plot для класса DocPolynom).................................................................20

Designing Related Classes (Создание связанных классов)................................................................................................................22

Example — A Simple Class Hierarchy (Пример – простая иерархия классов)......................................................22

Shared and Specialized Properties(Разделяемые и специализированные свойства)..............................23

Designing a Class for Financial Assets (Разработка класса финансовых активов)........................................24

Displaying the Class Files (Отображение файлов класса)..................................................................................................25

Summary of the DocAsset Class (Резюме класса DocAsset)......................................................................25

The DocAsset Constructor Method (DocAsset- конструктор-метод).........................................................26

Property Definition Block (Блок определения свойств)........................................................................................26

Constructor Method Code (Код конструктор- метода).........................................................................................27

Set Function for Type Property (Set-функция для свойства Type)....................................................................27

The DocAsset Display Method (DocAsset-метод отображения).......................................................................................28

Designing a Class for Stock Assets (Разработка класса для stock-активов)..............................................29

Displaying the Class Files (Отображение файлов класса)..................................................................................................29

Summary of the DocStock Class (Резюме для класса DocStock)..............................................................................29

Specifying the Base Class (Спецификация базового класса)..........................................................................30

Property Definition Block (Блок определения свойств)........................................................................................30

Using the DocStock Class (Использование класса DocStock)..................................................................................31

The DocStock Constructor Method (DocStock- конструктор-метод)....................................................................31

The DocStock disp Method (DocStock-disp-

метод)...........................................................................................32

Designing a Class for Bond Assets (Разработка класса bond-активов).....................................................32

Displaying the Class Files (Отображение файлов класса)..................................................................................................33

Summary of the DocBond Class (Резюме для класса DocBond)................................................................................33

Specifying the Base Class (Спецификация базового класса)..........................................................................34

Property Definition Block (Блок определения свойств)........................................................................................34

Using the DocBond Class (Использование класса DocBond)....................................................................................35

The DocBond Constructor Method (DocBond- коструктор-метод)......................................................................35

The calc_value Method (Метод calc_value).....36

The DocBond disp Method (DocBond-disp-

метод)...........................................................................................37

Designing a Class for Savings Assets (Разработка класса savings-активов).................................................37

Displaying the Class Files (Отображение файлов класса)..................................................................................................38

Summary of the DocSavings Class (Резюме класса DocSavings).........................................................................38

Specifying the Base Class (Спецификация базового класса)..........................................................................39

Property Definition Block (Блок определения свойств)........................................................................................39

Using the DocSavings Class (Использование класса DocSavings).................................................................39

The DocSavings Constructor Method (DocSavings-конструктор-метод)..............................................40

The DocSavings disp Method (DocSavings-disp- метод)...........................................................................................40

Example — Containing Assets into a Portfolio (Пример – содержание активов в portfolio).......................................................................................................41

Designing the DocPortfolio Class (Разработка класса DocPortfolio)....................................................................41

Displaying the Class Files (Отображение файлов класса)..................................................................................................42

Summary of the DocPortfolio Class (Резюме для класса DocPortfolio).............................................................42

Property Definition Block (Блок определения свойств)........................................................................................43

How Class Properties Are Used (Как использовать свойства класса)..................................................43

Using the DocPortfolio Class (Использование класса DocPortfolio)............................................................44

The DocPortfolio Constructor Method (DocPortfolio- конструктор-метод)....................................................45

The DocPortfolio disp Method (DocPortfolio- disp-метод)...........................................................................................46

The DocPortfolio pie3 Method (DocPortfolio- pie3-метод)...........................................................................................46

Visualizing a Portfolio (Portfolio-визуализация)......48

Examples(Примеры).........................................................................48

БИБЛИОГРАФИЧЕСКИЙ СПИСОК............................................................................................................49

ПРИЛОЖЕНИЯ................................................................................................50

Приложение 1 –класс DocPolynom..............................................................50

Приложение 2 – класс DocAsset...................................................................53

Приложение 3 – класс DocStock...................................................................54

Приложение 4 – класс DocBond......................................................................55

Приложение 5 – классDocSavings..............................................................56

Приложение 6 – классDocPortfolio.........................................................57

Приложение 7 –MATLAB-функции...............................................................59

О д и н о к о в Валерий Федорович

MATLABR2008a. Классы. Часть 4