Trabajo

Páginas: 9 (2094 palabras) Publicado: 12 de junio de 2012
Path: http://www.mathworks.es/help/techdoc/ref
Código para hacer funcionar los picos de vibración en una función:
Z = peaks;
figure('Renderer','zbuffer');
surf(Z);
axis tight;
set(gca,'NextPlot','replaceChildren');
for j = 1:40
surf(sin(2*pi*j/40)*Z,Z)
F(j) = getframe;
end
movie(F,40) % Play the movie twenty time
Código para generar un cilindro definido por la función de perfil 2 + sin(t).
t = 0:pi/10:2*pi;
[X,Y,Z] = cylinder(2+cos(t));
surf(X,Y,Z)
axis square
Código para dar color de una esfera con el patrón de un s-1 y en una matriz de Hadamard.
k = 5;
n = 2^k-1;
[x,y,z] = sphere(n);
c = hadamard(2^k);
surf(x,y,z,c);
colormap([1 1 0; 0 1 1])
axis equal
Código para encontrar el rango de precios de las acciones para el análisis de sensibilidad
% Range of stock prices forsensitivity analysis
range = 20:90;
plen = length(range);

% Basic information for each option
exprice = [75 70 50 55 75 50 40 75 60 35];
rate = 0.1*ones(10,1);
time = [36 36 36 27 18 18 18 9 9 9];
sigma = 0.35*ones(10,1);

% Portfolio weights
numopt = 1000*[4 8 3 5 5.5 2 4.8 3 4.8 2.5];

zval = zeros(36, plen);
color = zeros(36, plen);
>>
>> for i = 1:10
pad =ones(time(i),plen);
newr = range(ones(time(i),1),:);

t = (1:time(i))';
newt = t(:,ones(plen,1));

% Calculate gammas
zval(36-time(i)+1:36,:) = zval(36-time(i)+1:36,:) ...
+ numopt(i) * blsgamma(newr, exprice(i)*pad, ...
rate(i)*pad, newt/36, sigma(i)*pad);

% Calculate deltas
color(36-time(i)+1:36,:) =color(36-time(i)+1:36,:) ...
+ numopt(i) * blsdelta(newr, exprice(i)*pad, ...
rate(i)*pad, newt/36, sigma(i)*pad);
end
>> figure('NumberTitle', 'off', ...
'Name', 'Call Option Portfolio Sensitivity');

mesh(range, 1:36, zval, color);
view(60,60);
set(gca, 'xdir','reverse', 'tag', 'mesh_axes_3');
axis([20 90 0 36 -inf inf]);

title('Call Option Portfolio Sensitivity');xlabel('Stock Price ($)');
ylabel('Time (months)');
zlabel('Gamma');
set(gca, 'box', 'on');
cbx = colorbar('horiz');
apos = get(gca,'Position');
cpos = get(cbx,'Position');
set(cbx,'Position',[cpos(1) .075 cpos(3) cpos(4)])
set(gca,'Position',[apos(1) .25 apos(3) .68])

Ejemplo de uso del GUIDE de Matlab:
Formulario para desarrollar gráficos utilizando la forma: surf, mesh y contour de tres funciones:peaks, membrane y sinc.
function varargout = simple_gui(varargin)
% SIMPLE_GUI M-file for simple_gui.fig
% SIMPLE_GUI, by itself, creates a new SIMPLE_GUI or raises the existing
% singleton*.
%
% H = SIMPLE_GUI returns the handle to a new SIMPLE_GUI or the handle to
% the existing singleton*.
%
% SIMPLE_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
%function named CALLBACK in SIMPLE_GUI.M with the given input arguments.
%
% SIMPLE_GUI('Property','Value',...) creates a new SIMPLE_GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before simple_gui_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. Allinputs are passed to simple_gui_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help simple_gui

% Last Modified by GUIDE v2.5 02-May-2012 22:21:04

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @simple_gui_OpeningFcn, ...
'gui_OutputFcn', @simple_gui_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback =...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Trabajadores Del Trabajo
  • trabajo del trabajo
  • Trabajo Del Trabajo
  • El trabajo y el Trabajador
  • Trabajo Trabajador
  • trabajo trabajo
  • trabajo trabajo
  • Trabajo de trabajo

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS