Documentos de Académico
Documentos de Profesional
Documentos de Cultura
CODIGOS EN MATLAB
FUNCIN DELTA DIRAC:
function[x,n]=delta(n0,n1,n2)
n=n1:n2;
x=(n-n0)==0;
>> [x,n]=delta(1,-1,4)
x=
0
1
0
0
0
-1
1
3
2
4
n=
>> stem(n,x)
function[x,n]=escalon(a,n0,n1,n
2)
n=n1:n2;
x=(n-n0)>=0;
x=a*x;
>> [x,n]=escalon(5,0,-1,3)
x=
0
5
5
5
5
n=
-1
0
1
2
3
>> stem(n,x)
pg. 1
FUNCIN SENO:
function[x,n]=sen(a,t,f,n1,n2)
n=n1:n2;
x=a*sin(((2*pi/t)*n)+f);
>>
[x,n]=sen(8,12,0.1,0,18)
>> stem(n,x)
FUNCIN EXPONENCIAL:
function[x,n]=
potencialdis(a,f,b,n1,n2)
n=n1:n2;
af=f.^(-b*n);
x=a*af;
>>
[x,n]=potencialdis(1000,2,0.5
,0,20)
>> stem(n,x)
pg. 2
[x2,n2]=escalon(1,0,-5,20)
[x1,n1]=delta(1,-5,20)
CODIGOS EN C++
pg. 3
pg. 4
FUNCIN ESCALN:
#include<math.h>
#include <iostream>
#include <stdlib.h>
main() {
int n[100];
int x[100];
int k;
file *pf;
if(!(pf=fopen("datos.txt","w"))){
exit(0);
}
else{
for(k=-10;k<80;k++){
n[k+10]=k;
if(k>4){
x[k+10]=1;
}
else{
x[k+10]=0;
}
fprintf(pf,"%d %d\n",n[k+10],x[k+10]);
}
fclose(pf);
}
return 0;
}
FUNCIN EXPONENCIAL:
pg. 5
pg. 6