SlideShare una empresa de Scribd logo
1 de 14
ALGUNAS FUNCIONES DE MATLAB PARA MANEJO DE VECTORES
>> v=[2 4 7 3 5 7 8 6]; 
>> n=length(v) 
n = 
8 
>> s=sum(v) 
s = 
42 
>> m=max(v)
m = 
8 
>> [m,p]=max(v) 
m = 
8 
p = 
7 
>> p=mean(v) 
p = 
5.2500 
>> v=[2 4 7 3 5 7 8 6]; 
>> e=ismember(8,v) 
e =
1 
>> e=ismember(9,v) 
e = 
0 
>> [e,p]=ismember(8,v) 
e = 
1 
p = 
7
%INGRESO DE DATOS DE UN VECTOR A UN PROGRAMA 
N=input('CUANDO DATOS: '); 
V=[]; 
for I=1:N 
X=input('INGRESE DATO: '); 
V=[V,X]; 
end 
disp(V); 
%LA MANERA TRADICIONAL ES EL INGRESO DE CADA DATO INDIVIDUALMENTE AL 
VECTOR USANDO UN INDICE 
(PREVIAMENTE REQUIERE CONOCER CUANDOS DATOS SE LEERAN)
%CREAR UN VECTOR ALEATORIO AGREGANDO CADA 
(NUMEROS DE UN DIGITO) 
%CREAR UN VECTOR ALEATORIO AGREGANDO CADA DATO AL VECTOR 
N=input('CUANTOS NUMEROS?: '); 
V=[]; 
for I=1:N 
X=fix(rand*10); 
V=[V,X]; 
end 
disp(V);
%TAMBIEN SE PUEDE CREAR EL VECTOR ASIGNADO LOS VALORES MEDIANTE UN 
INDICE 
%TAMBIEN SE PUEDE CREAR EL VECTOR ASIGNADO LOS VALORES MEDIANTE UN 
INDICE 
N=input('CUANTOS NUMEROS?: '); 
V=[]; 
for I=1:N 
V(I)=fix(rand*10); 
End 
DADO UN VECTOR SUME SUS COMPONENTES
%DADO UN VECTOR SUME SUS COMPONENTES 
X=input('INGRESE VECTOR: '); 
N=length(X); 
S=0; 
for I=1:N 
S=S+X(I); 
end 
disp('LA SUMA ES '); 
disp(S); 
%SUMA DE COMPONENTES CON VALOR IMPAR DE UN VECTOR
%SUMA DE COMPONENTES CON VALOR IMPAR DE UN VECTOR 
X=input('INGRESE VECTOR: '); 
N=length(X); 
S=0; 
for I=1:N 
if mod (X(I),2)~=0 
S=S+X(I); 
end 
end 
disp(S); 
%DADO UN VECTOR ENCUENTRE EL MAYOR VALOR 
X=input('INGRESE VECTOR: '); 
N=length(X); 
M=X(1); 
for I=2:N 
if X(I)>M 
M=X(I); 
end 
end 
disp(M);
%DADO UN NUMERO ENTERO, ENCUENTRE LOS DIGITOS DE SU EQUIVALENTE EN EL 
%SISTEMA BINARIO 
%DADO UN NUMERO ENTERO, ENCUENTRE LOS DIGITOS DE SU EQUIVALENTE EN EL 
%SISTEMA BINARIO 
X=input('INGRESE UN NUMERO: '); 
B=[]; 
while X>0 
D=mod(X,2); 
X=fix(X/2); 
B=[D,B]; 
end 
disp(B);
%SIMULE N LANZAMIENTOS DE UN DADO 
%MUESTRE LA CANTIDAD DE VECES QUE SALE CADA NUMERO 
N=input('¿CUANTAS PRUEBAS?: '); 
c=[0 0 0 0 0 0 ]; 
for I=1:N 
D=fix(rand*6)+1; 
switch D 
case 1, c(1)=c(1)+1; 
case 2, c(2)=c(2)+1; 
case 3, c(3)=c(3)+1; 
case 4, c(4)=c(4)+1; 
case 5, C(5)=c(5)+1; 
case 6, c(6)=c(6)+1; 
end 
end 
disp(c);
%ESCRIBA UN PROGRAMA Q LEA DESDE TECLADO 2 VECTORES Y DETERMINE LA 
%CANTIDAD DE ELEMENTOS COMUNES ENTRE AMBOS VECTORES
%COLOCAR EL MAYOR VALOR DE UN VECTOR EN LA ULTIMA POSICION 
X=input('INGRESE VECTOR: '), 
N=length(X); 
for J=1:N-1 
if X(J)>X(N) 
T=X(J); 
X(J)=X(N); 
X(N)=T; 
end 
end 
disp(X);
Algunas funciones de matlab para manejo de vectores

Más contenido relacionado

La actualidad más candente

La actualidad más candente (18)

Try catch
Try catchTry catch
Try catch
 
Bucles y switch
Bucles y switchBucles y switch
Bucles y switch
 
Matriz Asociada a la Aplicacion
Matriz Asociada a la AplicacionMatriz Asociada a la Aplicacion
Matriz Asociada a la Aplicacion
 
FuncióN Exponencial
FuncióN ExponencialFuncióN Exponencial
FuncióN Exponencial
 
Practica 9
Practica 9Practica 9
Practica 9
 
Rubrique84
Rubrique84Rubrique84
Rubrique84
 
04explicacinejemplo 150421103551-conversion-gate01
04explicacinejemplo 150421103551-conversion-gate0104explicacinejemplo 150421103551-conversion-gate01
04explicacinejemplo 150421103551-conversion-gate01
 
11
1111
11
 
Clase de ecuaciones diferenciales
Clase de ecuaciones diferencialesClase de ecuaciones diferenciales
Clase de ecuaciones diferenciales
 
Funciones especiales en R
Funciones especiales en RFunciones especiales en R
Funciones especiales en R
 
Lab Sistemas Distribuidos y Paralelos Actividad 4
Lab Sistemas Distribuidos y Paralelos Actividad 4Lab Sistemas Distribuidos y Paralelos Actividad 4
Lab Sistemas Distribuidos y Paralelos Actividad 4
 
Arreglo hacer un programa para ingresar n valores reales en un arreglo y los ...
Arreglo hacer un programa para ingresar n valores reales en un arreglo y los ...Arreglo hacer un programa para ingresar n valores reales en un arreglo y los ...
Arreglo hacer un programa para ingresar n valores reales en un arreglo y los ...
 
Practica 9
Practica 9Practica 9
Practica 9
 
Matriz
MatrizMatriz
Matriz
 
Graficas
GraficasGraficas
Graficas
 
Ecuaciones exactas
Ecuaciones exactasEcuaciones exactas
Ecuaciones exactas
 
Calculo integral
Calculo integralCalculo integral
Calculo integral
 
Recuperacion programas
Recuperacion programasRecuperacion programas
Recuperacion programas
 

Destacado

Tablas y funciones
Tablas y funcionesTablas y funciones
Tablas y funcionesWadanohara
 
Generalidades de la célula
Generalidades de la célulaGeneralidades de la célula
Generalidades de la célulaSofia Paz
 
Transporte y membranas
Transporte y membranasTransporte y membranas
Transporte y membranasSofia Paz
 
MUESTREO Y RECONSTRUCCION DE SEÑALES
MUESTREO Y RECONSTRUCCION DE SEÑALESMUESTREO Y RECONSTRUCCION DE SEÑALES
MUESTREO Y RECONSTRUCCION DE SEÑALESLinda Yesenia
 
Mat lab manipulación de señales de audio
Mat lab manipulación de señales de audioMat lab manipulación de señales de audio
Mat lab manipulación de señales de audioRick P
 
filtro FIR pasabanda con MATLAB
filtro FIR pasabanda con MATLABfiltro FIR pasabanda con MATLAB
filtro FIR pasabanda con MATLABchrisleoflg
 
PROCESAMIENTO DIGITAL DE SEÑALES CON MATLAB
PROCESAMIENTO DIGITAL DE SEÑALES CON MATLABPROCESAMIENTO DIGITAL DE SEÑALES CON MATLAB
PROCESAMIENTO DIGITAL DE SEÑALES CON MATLABINFOVIC
 
Matlab: Procedures And Functions
Matlab: Procedures And FunctionsMatlab: Procedures And Functions
Matlab: Procedures And Functionsmatlab Content
 
Advanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & ScientistsAdvanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & ScientistsRay Phan
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLABRavikiran A
 
Muestreo y cuantificación de una señal analógica con MatLab
Muestreo y cuantificación de una señal analógica con MatLabMuestreo y cuantificación de una señal analógica con MatLab
Muestreo y cuantificación de una señal analógica con MatLabmarco calderon layme
 
Procesamiento digital de señales con matlab
Procesamiento digital de señales con matlabProcesamiento digital de señales con matlab
Procesamiento digital de señales con matlabPercy Julio Chambi Pacco
 
Ejercicios MATLAB
Ejercicios MATLABEjercicios MATLAB
Ejercicios MATLABdwquezada
 
Solucion de-problemas-de-ingenieria-con-matlab
Solucion de-problemas-de-ingenieria-con-matlabSolucion de-problemas-de-ingenieria-con-matlab
Solucion de-problemas-de-ingenieria-con-matlabWilson Bautista
 
Image processing- an introduction
Image processing- an introductionImage processing- an introduction
Image processing- an introductionAarohi Gupta
 
Image proceesing with matlab
Image proceesing with matlabImage proceesing with matlab
Image proceesing with matlabAshutosh Shahi
 

Destacado (19)

Tablas y funciones
Tablas y funcionesTablas y funciones
Tablas y funciones
 
Generalidades de la célula
Generalidades de la célulaGeneralidades de la célula
Generalidades de la célula
 
Image processing
Image processingImage processing
Image processing
 
Transporte y membranas
Transporte y membranasTransporte y membranas
Transporte y membranas
 
MUESTREO Y RECONSTRUCCION DE SEÑALES
MUESTREO Y RECONSTRUCCION DE SEÑALESMUESTREO Y RECONSTRUCCION DE SEÑALES
MUESTREO Y RECONSTRUCCION DE SEÑALES
 
Mat lab manipulación de señales de audio
Mat lab manipulación de señales de audioMat lab manipulación de señales de audio
Mat lab manipulación de señales de audio
 
filtro FIR pasabanda con MATLAB
filtro FIR pasabanda con MATLABfiltro FIR pasabanda con MATLAB
filtro FIR pasabanda con MATLAB
 
PROCESAMIENTO DIGITAL DE SEÑALES CON MATLAB
PROCESAMIENTO DIGITAL DE SEÑALES CON MATLABPROCESAMIENTO DIGITAL DE SEÑALES CON MATLAB
PROCESAMIENTO DIGITAL DE SEÑALES CON MATLAB
 
Matlab: Procedures And Functions
Matlab: Procedures And FunctionsMatlab: Procedures And Functions
Matlab: Procedures And Functions
 
Advanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & ScientistsAdvanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & Scientists
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Curso de simulink 2 0
Curso de simulink 2 0Curso de simulink 2 0
Curso de simulink 2 0
 
Muestreo y cuantificación de una señal analógica con MatLab
Muestreo y cuantificación de una señal analógica con MatLabMuestreo y cuantificación de una señal analógica con MatLab
Muestreo y cuantificación de una señal analógica con MatLab
 
Procesamiento digital de señales con matlab
Procesamiento digital de señales con matlabProcesamiento digital de señales con matlab
Procesamiento digital de señales con matlab
 
Ejercicios MATLAB
Ejercicios MATLABEjercicios MATLAB
Ejercicios MATLAB
 
Solucion de-problemas-de-ingenieria-con-matlab
Solucion de-problemas-de-ingenieria-con-matlabSolucion de-problemas-de-ingenieria-con-matlab
Solucion de-problemas-de-ingenieria-con-matlab
 
Image processing- an introduction
Image processing- an introductionImage processing- an introduction
Image processing- an introduction
 
Image proceesing with matlab
Image proceesing with matlabImage proceesing with matlab
Image proceesing with matlab
 
Getting started with image processing using Matlab
Getting started with image processing using MatlabGetting started with image processing using Matlab
Getting started with image processing using Matlab
 

Similar a Algunas funciones de matlab para manejo de vectores

Similar a Algunas funciones de matlab para manejo de vectores (20)

Ejemplos java
Ejemplos javaEjemplos java
Ejemplos java
 
Clases graficas ultima_clase_matlab
Clases graficas ultima_clase_matlabClases graficas ultima_clase_matlab
Clases graficas ultima_clase_matlab
 
Laboratorio 5 mecanica_computacional[1]
Laboratorio 5 mecanica_computacional[1]Laboratorio 5 mecanica_computacional[1]
Laboratorio 5 mecanica_computacional[1]
 
Electrónica: Tutorial de Matlab aplicado
Electrónica: Tutorial de Matlab aplicadoElectrónica: Tutorial de Matlab aplicado
Electrónica: Tutorial de Matlab aplicado
 
Fundamentos de programación en scilab
Fundamentos de programación en scilabFundamentos de programación en scilab
Fundamentos de programación en scilab
 
Programa
ProgramaPrograma
Programa
 
Informe de laboratorio 4
Informe de laboratorio 4Informe de laboratorio 4
Informe de laboratorio 4
 
Netsbeans
NetsbeansNetsbeans
Netsbeans
 
B2 T5 Vectores Ii
B2 T5 Vectores IiB2 T5 Vectores Ii
B2 T5 Vectores Ii
 
Practicas prolog2011
Practicas prolog2011Practicas prolog2011
Practicas prolog2011
 
jaisan
jaisanjaisan
jaisan
 
Metodos numéricos
Metodos numéricosMetodos numéricos
Metodos numéricos
 
Metodos numéricos (1)
Metodos numéricos (1)Metodos numéricos (1)
Metodos numéricos (1)
 
Aritmetica
AritmeticaAritmetica
Aritmetica
 
matlab
matlabmatlab
matlab
 
Algoritmos para matlab
Algoritmos para matlabAlgoritmos para matlab
Algoritmos para matlab
 
PROBLEMAS DE POGRAMACION 1
PROBLEMAS DE POGRAMACION 1PROBLEMAS DE POGRAMACION 1
PROBLEMAS DE POGRAMACION 1
 
Introducion al matlab
Introducion al matlabIntroducion al matlab
Introducion al matlab
 
Ejercicios de programación.
Ejercicios de programación.Ejercicios de programación.
Ejercicios de programación.
 
Practica 1 Introduccion Al R
Practica 1 Introduccion Al RPractica 1 Introduccion Al R
Practica 1 Introduccion Al R
 

Último

Historia y técnica del collage en el arte
Historia y técnica del collage en el arteHistoria y técnica del collage en el arte
Historia y técnica del collage en el arteRaquel Martín Contreras
 
La Función tecnológica del tutor.pptx
La  Función  tecnológica  del tutor.pptxLa  Función  tecnológica  del tutor.pptx
La Función tecnológica del tutor.pptxJunkotantik
 
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...Carlos Muñoz
 
CALENDARIZACION DE MAYO / RESPONSABILIDAD
CALENDARIZACION DE MAYO / RESPONSABILIDADCALENDARIZACION DE MAYO / RESPONSABILIDAD
CALENDARIZACION DE MAYO / RESPONSABILIDADauxsoporte
 
La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.amayarogel
 
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdfPlanificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdfDemetrio Ccesa Rayme
 
2024 - Expo Visibles - Visibilidad Lesbica.pdf
2024 - Expo Visibles - Visibilidad Lesbica.pdf2024 - Expo Visibles - Visibilidad Lesbica.pdf
2024 - Expo Visibles - Visibilidad Lesbica.pdfBaker Publishing Company
 
Resolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdf
Resolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdfResolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdf
Resolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdfDemetrio Ccesa Rayme
 
Informatica Generalidades - Conceptos Básicos
Informatica Generalidades - Conceptos BásicosInformatica Generalidades - Conceptos Básicos
Informatica Generalidades - Conceptos BásicosCesarFernandez937857
 
Caja de herramientas de inteligencia artificial para la academia y la investi...
Caja de herramientas de inteligencia artificial para la academia y la investi...Caja de herramientas de inteligencia artificial para la academia y la investi...
Caja de herramientas de inteligencia artificial para la academia y la investi...Lourdes Feria
 
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...JAVIER SOLIS NOYOLA
 
SINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptx
SINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptxSINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptx
SINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptxlclcarmen
 
Manual - ABAS II completo 263 hojas .pdf
Manual - ABAS II completo 263 hojas .pdfManual - ABAS II completo 263 hojas .pdf
Manual - ABAS II completo 263 hojas .pdfMaryRotonda1
 
Identificación de componentes Hardware del PC
Identificación de componentes Hardware del PCIdentificación de componentes Hardware del PC
Identificación de componentes Hardware del PCCesarFernandez937857
 
RAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIA
RAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIARAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIA
RAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIACarlos Campaña Montenegro
 
Introducción:Los objetivos de Desarrollo Sostenible
Introducción:Los objetivos de Desarrollo SostenibleIntroducción:Los objetivos de Desarrollo Sostenible
Introducción:Los objetivos de Desarrollo SostenibleJonathanCovena1
 
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxTIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxlclcarmen
 
30-de-abril-plebiscito-1902_240420_104511.pdf
30-de-abril-plebiscito-1902_240420_104511.pdf30-de-abril-plebiscito-1902_240420_104511.pdf
30-de-abril-plebiscito-1902_240420_104511.pdfgimenanahuel
 

Último (20)

Historia y técnica del collage en el arte
Historia y técnica del collage en el arteHistoria y técnica del collage en el arte
Historia y técnica del collage en el arte
 
Defendamos la verdad. La defensa es importante.
Defendamos la verdad. La defensa es importante.Defendamos la verdad. La defensa es importante.
Defendamos la verdad. La defensa es importante.
 
La Función tecnológica del tutor.pptx
La  Función  tecnológica  del tutor.pptxLa  Función  tecnológica  del tutor.pptx
La Función tecnológica del tutor.pptx
 
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
 
CALENDARIZACION DE MAYO / RESPONSABILIDAD
CALENDARIZACION DE MAYO / RESPONSABILIDADCALENDARIZACION DE MAYO / RESPONSABILIDAD
CALENDARIZACION DE MAYO / RESPONSABILIDAD
 
La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.
 
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdfPlanificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdf
 
2024 - Expo Visibles - Visibilidad Lesbica.pdf
2024 - Expo Visibles - Visibilidad Lesbica.pdf2024 - Expo Visibles - Visibilidad Lesbica.pdf
2024 - Expo Visibles - Visibilidad Lesbica.pdf
 
Resolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdf
Resolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdfResolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdf
Resolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdf
 
Informatica Generalidades - Conceptos Básicos
Informatica Generalidades - Conceptos BásicosInformatica Generalidades - Conceptos Básicos
Informatica Generalidades - Conceptos Básicos
 
Caja de herramientas de inteligencia artificial para la academia y la investi...
Caja de herramientas de inteligencia artificial para la academia y la investi...Caja de herramientas de inteligencia artificial para la academia y la investi...
Caja de herramientas de inteligencia artificial para la academia y la investi...
 
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
 
SINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptx
SINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptxSINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptx
SINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptx
 
Manual - ABAS II completo 263 hojas .pdf
Manual - ABAS II completo 263 hojas .pdfManual - ABAS II completo 263 hojas .pdf
Manual - ABAS II completo 263 hojas .pdf
 
Identificación de componentes Hardware del PC
Identificación de componentes Hardware del PCIdentificación de componentes Hardware del PC
Identificación de componentes Hardware del PC
 
RAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIA
RAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIARAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIA
RAIZ CUADRADA Y CUBICA PARA NIÑOS DE PRIMARIA
 
Power Point: "Defendamos la verdad".pptx
Power Point: "Defendamos la verdad".pptxPower Point: "Defendamos la verdad".pptx
Power Point: "Defendamos la verdad".pptx
 
Introducción:Los objetivos de Desarrollo Sostenible
Introducción:Los objetivos de Desarrollo SostenibleIntroducción:Los objetivos de Desarrollo Sostenible
Introducción:Los objetivos de Desarrollo Sostenible
 
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxTIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
 
30-de-abril-plebiscito-1902_240420_104511.pdf
30-de-abril-plebiscito-1902_240420_104511.pdf30-de-abril-plebiscito-1902_240420_104511.pdf
30-de-abril-plebiscito-1902_240420_104511.pdf
 

Algunas funciones de matlab para manejo de vectores

  • 1. ALGUNAS FUNCIONES DE MATLAB PARA MANEJO DE VECTORES
  • 2. >> v=[2 4 7 3 5 7 8 6]; >> n=length(v) n = 8 >> s=sum(v) s = 42 >> m=max(v)
  • 3. m = 8 >> [m,p]=max(v) m = 8 p = 7 >> p=mean(v) p = 5.2500 >> v=[2 4 7 3 5 7 8 6]; >> e=ismember(8,v) e =
  • 4. 1 >> e=ismember(9,v) e = 0 >> [e,p]=ismember(8,v) e = 1 p = 7
  • 5. %INGRESO DE DATOS DE UN VECTOR A UN PROGRAMA N=input('CUANDO DATOS: '); V=[]; for I=1:N X=input('INGRESE DATO: '); V=[V,X]; end disp(V); %LA MANERA TRADICIONAL ES EL INGRESO DE CADA DATO INDIVIDUALMENTE AL VECTOR USANDO UN INDICE (PREVIAMENTE REQUIERE CONOCER CUANDOS DATOS SE LEERAN)
  • 6. %CREAR UN VECTOR ALEATORIO AGREGANDO CADA (NUMEROS DE UN DIGITO) %CREAR UN VECTOR ALEATORIO AGREGANDO CADA DATO AL VECTOR N=input('CUANTOS NUMEROS?: '); V=[]; for I=1:N X=fix(rand*10); V=[V,X]; end disp(V);
  • 7. %TAMBIEN SE PUEDE CREAR EL VECTOR ASIGNADO LOS VALORES MEDIANTE UN INDICE %TAMBIEN SE PUEDE CREAR EL VECTOR ASIGNADO LOS VALORES MEDIANTE UN INDICE N=input('CUANTOS NUMEROS?: '); V=[]; for I=1:N V(I)=fix(rand*10); End DADO UN VECTOR SUME SUS COMPONENTES
  • 8. %DADO UN VECTOR SUME SUS COMPONENTES X=input('INGRESE VECTOR: '); N=length(X); S=0; for I=1:N S=S+X(I); end disp('LA SUMA ES '); disp(S); %SUMA DE COMPONENTES CON VALOR IMPAR DE UN VECTOR
  • 9. %SUMA DE COMPONENTES CON VALOR IMPAR DE UN VECTOR X=input('INGRESE VECTOR: '); N=length(X); S=0; for I=1:N if mod (X(I),2)~=0 S=S+X(I); end end disp(S); %DADO UN VECTOR ENCUENTRE EL MAYOR VALOR X=input('INGRESE VECTOR: '); N=length(X); M=X(1); for I=2:N if X(I)>M M=X(I); end end disp(M);
  • 10. %DADO UN NUMERO ENTERO, ENCUENTRE LOS DIGITOS DE SU EQUIVALENTE EN EL %SISTEMA BINARIO %DADO UN NUMERO ENTERO, ENCUENTRE LOS DIGITOS DE SU EQUIVALENTE EN EL %SISTEMA BINARIO X=input('INGRESE UN NUMERO: '); B=[]; while X>0 D=mod(X,2); X=fix(X/2); B=[D,B]; end disp(B);
  • 11. %SIMULE N LANZAMIENTOS DE UN DADO %MUESTRE LA CANTIDAD DE VECES QUE SALE CADA NUMERO N=input('¿CUANTAS PRUEBAS?: '); c=[0 0 0 0 0 0 ]; for I=1:N D=fix(rand*6)+1; switch D case 1, c(1)=c(1)+1; case 2, c(2)=c(2)+1; case 3, c(3)=c(3)+1; case 4, c(4)=c(4)+1; case 5, C(5)=c(5)+1; case 6, c(6)=c(6)+1; end end disp(c);
  • 12. %ESCRIBA UN PROGRAMA Q LEA DESDE TECLADO 2 VECTORES Y DETERMINE LA %CANTIDAD DE ELEMENTOS COMUNES ENTRE AMBOS VECTORES
  • 13. %COLOCAR EL MAYOR VALOR DE UN VECTOR EN LA ULTIMA POSICION X=input('INGRESE VECTOR: '), N=length(X); for J=1:N-1 if X(J)>X(N) T=X(J); X(J)=X(N); X(N)=T; end end disp(X);