Sunteți pe pagina 1din 11

SIMULADOR DE CREDITO

IVAN ANDRES ULLOA INFANTE


DANIEL ORJUEGA

Presentado a:
Jeffrey Guevara

UNIVERSIDAD DE SANTANDER
FUNDAMENTOS DE PROGRAMACION
2017
OBJETIVOS
Objetivo general
 Realizar la simulación de un crédito utilizando el programa MATLAB con el
fin de aplicar la programación vista en clase.

Objetivos específicos
 Aplicar los conocimientos vistos en clase.
 Desarrollar una aplicación de la ingeniería civil utilizando MATLAB.
MARCO TEORICO
Crédito
El crédito o contrato de crédito es una operación financiera en la que una persona
(el acreedor) realiza un préstamo por una cantidad determinada de dinero a otra
persona (el deudor) y en la que este último, el deudor, se compromete a devolver la
cantidad solicitada (además del pago de los intereses devengados, seguros y costos
asociados si los hubiera) en el tiempo o plazo definido de acuerdo a las condiciones
establecidas para dicho préstamo.
Tabla de amortización
Un cuadro de amortización es una tabla donde se muestra el calendario
de pagos que se tiene que afrontar al concederse un préstamo. Es decir, es
un resumen de todos los pagos que tiene que realizar el prestatario (la persona que
disfruta del préstamo) durante la vida del préstamo.

El cuadro de amortización suele estar formado por cinco columnas:

 La primera columna es el periodo. Es decir, cada uno de los periodos se


refiere al momento en el que se tiene que realizar el pago.
 La segunda columna son los intereses. Aquí se indican los intereses que el
prestatario paga al prestamista en cada periodo. Se calcula multiplicando
el tipo de interés pactado por el capital pendiente (que como veremos es la
quinta columna). El interés puede ser fijo o variable.
 La tercera columna es la amortización del capital. La amortización consiste
en la devolución del préstamo, sin contar los intereses. Es decir, es lo que
se descuenta cada periodo del capital pendiente.
 La cuarta columna es la cuota a pagar, que es la suma de los intereses y la
amortización.
 La quinta columna es el capital del préstamo pendiente de amortizar. Para
calcularlo se resta en cada periodo el capital pendiente del periodo anterior
y la amortización del periodo actual.

Interés
Interés, en economía y finanzas, es un índice utilizado para medir la rentabilidad de
los ahorros e inversiones así también el costo de un crédito. Si por ejemplo se
hablara de un crédito bancario como un crédito hipotecario para la compra de
una vivienda. Se expresa como un porcentaje referido al total de la inversión o
crédito.
RESULTADO
 Código realizado en MATLAB
classdef simulador < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
SIMULADORUIFigure matlab.ui.Figure
SIMULADORDECREDITOLabel matlab.ui.control.Label
MONTODELPRESTAMOEditFieldLabel matlab.ui.control.Label
monto matlab.ui.control.NumericEditField
PLAZOENMESESEditFieldLabel matlab.ui.control.Label
plazo matlab.ui.control.NumericEditField
calcular matlab.ui.control.Button
tabla matlab.ui.control.Button
UItabla matlab.ui.control.Table
TL matlab.ui.control.Label
CL matlab.ui.control.Label
tipocredito matlab.ui.container.ButtonGroup
Libreinversion matlab.ui.control.RadioButton
Libranza matlab.ui.control.RadioButton
EA matlab.ui.control.Label
int matlab.ui.control.NumericEditField
cuo matlab.ui.control.NumericEditField
BORRARButton matlab.ui.control.Button
inicio matlab.ui.control.Label
titulo matlab.ui.control.Label
rea matlab.ui.control.Label
ivan matlab.ui.control.Label
daniel matlab.ui.control.Label
INICIO matlab.ui.control.Button
end
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)

end
% Button pushed function: BORRARButton
function BORRARButtonPushed(app, event)

app.monto.Value=0;
app.plazo.Value=0
app.cuo.Value=0;
app.int.Value=0;
m=[];

app.UItabla.Data=num2cell(m);

app.monto.Enable='on';
app.plazo.Enable='on';
app.cuo.Enable='on';

end
% Button pushed function: INICIO
function INICIOButtonPushed(app, event)
app.titulo.Visible='off';
app.rea.Visible='off';
app.ivan.Visible='off';
app.daniel.Visible='off';
app.INICIO.Visible='off';
app.inicio.Visible='off';

end
% Button pushed function: calcular
function calcularButtonPushed(app, event)
VP=app.monto.Value;
N=app.plazo.Value;
i=(app.int.Value)/100;
app.cuo.Value=(((VP*(1+(i))^N)*i)/(((1+(i))^N)-1));
cuota=app.cuo.Value;

app.monto.Enable='off';
app.plazo.Enable='off';
app.cuo.Enable='off';

end
% Button pushed function: tabla
function tablaButtonPushed(app, event)

VP=app.monto.Value;
N=app.plazo.Value;
i=(app.int.Value)/100;
app.cuo.Value=(((VP*(1+(i))^N)*(i))/(((1+(i))^N)-1));
cuota=app.cuo.Value;

periodo(1,1)=0;
interes(1,1)=0;
amortizacion(1,1)=0;
Cuota(1,1)=0;
saldo(1,1)=VP;

periodo(2,1)=1;
interes(2,1)=VP*i;
amortizacion(2,1)=cuota-interes(2,1);
Cuota(2,1)=cuota;
saldo(2,1)=VP-amortizacion(2,1);
for j=3:1:N+1

periodo(j,1)=j-1;
interes(j,1)=saldo(j-1,1)*i;
amortizacion(j,1)=cuota-interes(j,1);
Cuota(j,1)=cuota;
saldo(j,1)=saldo(j-1,1)-amortizacion(j,1);

end

m=[periodo interes amortizacion Cuota saldo];

app.UItabla.Data=num2cell(m);

end
% Selection changed function: tipocredito
function tipocreditoSelectionChanged(app, event)

switch app.tipocredito.SelectedObject.Text

case 'Libre inversion'


app.EA.Text='% EA';
app.int.Value= 20;

case 'Libranza'
app.EA.Text='% EA';
app.int.Value=18;
end

end
end
% App initialization and construction
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create SIMULADORUIFigure
app.SIMULADORUIFigure = uifigure;
app.SIMULADORUIFigure.Color = [0.9412 0.9412 0.9412];
app.SIMULADORUIFigure.Position = [100 100 748 499];
app.SIMULADORUIFigure.Name = 'SIMULADOR';
% Create SIMULADORDECREDITOLabel
app.SIMULADORDECREDITOLabel = uilabel(app.SIMULADORUIFigure);
app.SIMULADORDECREDITOLabel.FontName = 'Castellar';
app.SIMULADORDECREDITOLabel.FontSize = 26;
app.SIMULADORDECREDITOLabel.FontWeight = 'bold';
app.SIMULADORDECREDITOLabel.Position = [225 440 380 33];
app.SIMULADORDECREDITOLabel.Text = 'SIMULADOR DE CREDITO';
% Create MONTODELPRESTAMOEditFieldLabel
app.MONTODELPRESTAMOEditFieldLabel =
uilabel(app.SIMULADORUIFigure);
app.MONTODELPRESTAMOEditFieldLabel.BackgroundColor = [0.9412
0.9412 0.9412];
app.MONTODELPRESTAMOEditFieldLabel.HorizontalAlignment =
'right';
app.MONTODELPRESTAMOEditFieldLabel.Position = [43 402 145 15];
app.MONTODELPRESTAMOEditFieldLabel.Text = 'MONTO DEL PRESTAMO';
% Create monto
app.monto = uieditfield(app.SIMULADORUIFigure, 'numeric');
app.monto.ValueDisplayFormat = '%.0f';
app.monto.BackgroundColor = [0.9412 0.9412 0.9412];
app.monto.Position = [203 398 100 22];
% Create PLAZOENMESESEditFieldLabel
app.PLAZOENMESESEditFieldLabel = uilabel(app.SIMULADORUIFigure);
app.PLAZOENMESESEditFieldLabel.BackgroundColor = [0.9412 0.9412
0.9412];
app.PLAZOENMESESEditFieldLabel.HorizontalAlignment = 'right';
app.PLAZOENMESESEditFieldLabel.Position = [43 355 109 15];
app.PLAZOENMESESEditFieldLabel.Text = 'PLAZO EN MESES';
% Create plazo
app.plazo = uieditfield(app.SIMULADORUIFigure, 'numeric');
app.plazo.ValueDisplayFormat = '%.0f';
app.plazo.BackgroundColor = [0.9412 0.9412 0.9412];
app.plazo.Position = [203 351 100 22];
% Create calcular
app.calcular = uibutton(app.SIMULADORUIFigure, 'push');
app.calcular.ButtonPushedFcn = createCallbackFcn(app,
@calcularButtonPushed, true);
app.calcular.Position = [187 296 126 22];
app.calcular.Text = 'CALCULAR CUOTA';
% Create tabla
app.tabla = uibutton(app.SIMULADORUIFigure, 'push');
app.tabla.ButtonPushedFcn = createCallbackFcn(app,
@tablaButtonPushed, true);
app.tabla.Position = [117.5 239 195 22];
app.tabla.Text = 'VER TABLA DE AMORTIZACION';
% Create UItabla
app.UItabla = uitable(app.SIMULADORUIFigure);
app.UItabla.ColumnName = {'PERIODO'; 'INTERES'; 'AMORTIZACION';
'CUOTA'; 'SALDO'};
app.UItabla.RowName = {};
app.UItabla.Position = [32 25 683 202];
% Create TL
app.TL = uilabel(app.SIMULADORUIFigure);
app.TL.Position = [548 375 114 15];
app.TL.Text = 'TASA DE INTERES:';
% Create CL
app.CL = uilabel(app.SIMULADORUIFigure);
app.CL.Position = [432 300 50 15];
app.CL.Text = 'CUOTA:';
% Create tipocredito
app.tipocredito = uibuttongroup(app.SIMULADORUIFigure);
app.tipocredito.SelectionChangedFcn = createCallbackFcn(app,
@tipocreditoSelectionChanged, true);
app.tipocredito.Title = 'Tipo de Credito';
app.tipocredito.BackgroundColor = [0.9412 0.9412 0.9412];
app.tipocredito.Position = [376 344 123 76];
% Create Libreinversion
app.Libreinversion = uiradiobutton(app.tipocredito);
app.Libreinversion.Text = 'Libre inversion';
app.Libreinversion.Position = [11 30 103 15];
app.Libreinversion.Value = true;
% Create Libranza
app.Libranza = uiradiobutton(app.tipocredito);
app.Libranza.Text = 'Libranza';
app.Libranza.Position = [11 8 70 15];
% Create EA
app.EA = uilabel(app.SIMULADORUIFigure);
app.EA.Position = [689 375 56 15];
app.EA.Text = '';
% Create int
app.int = uieditfield(app.SIMULADORUIFigure, 'numeric');
app.int.ValueDisplayFormat = '%.0f';
app.int.Editable = 'off';
app.int.Enable = 'off';
app.int.Position = [661 371 24 22];
% Create cuo
app.cuo = uieditfield(app.SIMULADORUIFigure, 'numeric');
app.cuo.ValueDisplayFormat = '%.0f';
app.cuo.BackgroundColor = [0.9412 0.9412 0.9412];
app.cuo.Position = [481 296 100 22];
% Create BORRARButton
app.BORRARButton = uibutton(app.SIMULADORUIFigure, 'push');
app.BORRARButton.ButtonPushedFcn = createCallbackFcn(app,
@BORRARButtonPushed, true);
app.BORRARButton.Position = [538.5 239 109 22];
app.BORRARButton.Text = 'BORRAR';
% Create inicio
app.inicio = uilabel(app.SIMULADORUIFigure);
app.inicio.BackgroundColor = [0.9412 0.9412 0.9412];
app.inicio.Position = [19 12 708 477];
app.inicio.Text = '';
% Create titulo
app.titulo = uilabel(app.SIMULADORUIFigure);
app.titulo.FontName = 'Castellar';
app.titulo.FontSize = 24;
app.titulo.FontWeight = 'bold';
app.titulo.Position = [197 419 351 30];
app.titulo.Text = 'SIMULADOR DE CREDITO';
% Create rea
app.rea = uilabel(app.SIMULADORUIFigure);
app.rea.FontName = 'Castellar';
app.rea.FontSize = 16;
app.rea.Position = [216 326 313 19];
app.rea.Text = 'PROGRAMACION REALIZADA POR:';
% Create ivan
app.ivan = uilabel(app.SIMULADORUIFigure);
app.ivan.FontName = 'Castellar';
app.ivan.FontSize = 16;
app.ivan.Position = [234 268 282 19];
app.ivan.Text = 'IVAN ANDRES ULLOA INFANTE';
% Create daniel
app.daniel = uilabel(app.SIMULADORUIFigure);
app.daniel.FontName = 'Castellar';
app.daniel.FontSize = 16;
app.daniel.Position = [295 226 159 19];
app.daniel.Text = 'DANIEL ORJUELA';
% Create INICIO
app.INICIO = uibutton(app.SIMULADORUIFigure, 'push');
app.INICIO.ButtonPushedFcn = createCallbackFcn(app,
@INICIOButtonPushed, true);
app.INICIO.Position = [323 139 100 22];
app.INICIO.Text = 'INICIAR';
end
end
methods (Access = public)
% Construct app
function app = simulador
% Create and configure components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.SIMULADORUIFigure)
% Execute the startup function
runStartupFcn(app, @startupFcn)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.SIMULADORUIFigure)
end
end
end
 Diseño de la aplicación

Inicio

Interfase
Aplicación

S-ar putea să vă placă și