Está en la página 1de 5

C:\Users\HOPE\Docume...\InterpolacionExcitacionSenowww.

m
Page 1
25 de abril de 2016
11:40:46 AM
1 tic
2 %Interpolacin de la Exitacin
3 %Tn=1;
4 fprintf('\nDATOS A INGRESAR');
5 fprintf('\n=======================================\n');
6 DurP=input('Ingrese la duracin del pulso: ');
7 Dt=input('Ingrese el valor de Delta T: ');
8 %DurP=0.6;%-------------------------------------MODIFICAR DURACIN DEL PULSO
9 %Dt=0.1;%-----------------------------------------------MODIFICAR DELTA DE T
10 Cros=2;%MODIFICAR CON: 1 PARA UNA DURACION DE PULSO 0.6 Y 0.2, Y CON 2.5 PARA 1.8 DE
D. PULSO
11 Tp=(0:Dt:Cros);%Paso
12 t=zeros(length(Tp),1);
13 Po=0.2;
14 %W=pi/DurP;
15 W=2*pi;
16 P=zeros(length(Tp),1);
17 for i=1:length(t)
18
t(i)=Tp(i);
19
if i<=(DurP/Dt)+1
20
P(i)=Po*sin(2*pi*t(i));
21
else
22
P(i)=0;
23
end
24 end
25 n=length(P);
26
27 m=1;%kip-s2/pulg
28 %k=1;%kips/pulg
29 %Wn=sqrt(k/m);%rad/s
30 Wn=W/0.2;
31 k=m*(Wn^2);
32 ca=0;%Coeficiente de amortiguamiento
33
34 %Clculos iniciales
35 Wd=Wn*((1-ca^2)^0.5);
36 A=(exp(-ca*Wn*Dt))*((ca/(1-ca^2)^0.5)*(sin(Wd*Dt))+(cos(Wd*Dt)));
37 B=(exp(-ca*Wn*Dt))*((1/Wd)*(sin(Wd*Dt)));
38 C=(1/k)*((2*ca/(Wn*Dt))+(exp(-ca*Wn*Dt))*((((1-2*ca^2)/(Wd*Dt))-(ca/(1-ca^2)^0.5))*
(sin(Wd*Dt))-(1+(2*ca/(Wn*Dt)))*(cos(Wd*Dt))));
39 D=(1/k)*(1-(2*ca/(Wn*Dt))+(exp(-ca*Wn*Dt))*(((2*(ca^2)-1)/(Wd*Dt))*(sin(Wd*Dt))+
(2*ca/(Wn*Dt))*(cos(Wd*Dt))));
40 Ap=-(exp(-ca*Wn*Dt))*((Wn/(1-ca^2)^0.5)*(sin(Wd*Dt)));
41 Bp=(exp(-ca*Wn*Dt))*((cos(Wd*Dt))-(ca/(1-ca^2)^0.5)*(sin(Wd*Dt)));
42 Cp=(1/k)*((-1/Dt)+(exp(-ca*Wn*Dt))*(((Wn/(1-ca^2)^0.5)+(ca/(Dt*(1-ca^2)^0.5)))*(sin
(Wd*Dt))+(1/Dt)*(cos(Wd*Dt))));
43 Dp=(1/(k*Dt))*(1-(exp(-ca*Wn*Dt))*((ca/(1-ca^2)^0.5)*(sin(Wd*Dt))+(cos(Wd*Dt))));
44 %Condiciones Iniciales
45 %W=pi;

C:\Users\HOPE\Docume...\InterpolacionExcitacionSenowww.m
Page 2
25 de abril de 2016
11:40:46 AM
46 u=zeros(n,1); up=zeros(n,1); ut=zeros(n,1); upt=zeros(n,1);
47 Aui=zeros(n,1); Bupi=zeros(n,1); Cpi=zeros(n,1); Dpi1=zeros(n,1);
48 Apui=zeros(n,1); Bpupi=zeros(n,1); Cppi=zeros(n,1); Dppi1=zeros(n,1);
49 fprintf('\nCondiciones iniciales');
50 fprintf('\n---------------------------------------\n');
51 %u(1)=input('Ingrese el desplazamiento inicial uo: ');
52 %up(1)=input('Ingrese la velocidad inicial upo: ');
53 u(1)=0; up(1)=0;%Po*Wn/k;%---------------------------MODIFICAR CONDICIONES INICIALES
54 uo=u(1); vo=up(1); %Po=1;
55 for i=1:n-1
56
Cpi(i)=C*P(i); Dpi1(i)=D*P(i+1); Aui(i)=A*u(i); Bupi(i)=B*up(i);
57
Cppi(i)=Cp*P(i); Dppi1(i)=Dp*P(i+1); Apui(i)=Ap*u(i); Bpupi(i)=Bp*up(i);
58
u(i+1)=Aui(i)+Bupi(i)+Cpi(i)+Dpi1(i);
59
up(i+1)=Apui(i)+Bpupi(i)+Cppi(i)+Dppi1(i);
60 end
61
62 clear i
63 fprintf('\nResultados:\n');
64 fprintf('\n=================');
65 fprintf('\n
ti
ui');
66 fprintf('\n
seg
');
67 fprintf('\n=================\n');
68 for i=1:n
69
fprintf('%6.3f %11.4e\n',t(i,1),u(i,1));
70 end
71 fprintf('----------------\n\n');
72
73 break
74 CC=(Po/k)*((1-(W/Wn)^2)/(((1-(W/Wn)^2)^2)+((2*ca*(W/Wn))^2)));
75 DD=(Po/k)*((-2*ca*(W/Wn))/(((1-(W/Wn)^2)^2)+((2*ca*(W/Wn))^2)));
76 AA=uo-DD;
77 BB=(vo-CC*W+AA*ca*Wn)/Wd;
78
79 V1=((DurP/Dt)+1);
80 zzz=(1:1:V1+1);
81 aaaa=length(zzz);
82 V2=n-aaaa;
83 for i=1:aaaa
84
ut(i)=exp(-1*ca*Wn*t(i))*(AA*cos(Wd*t(i))+BB*sin(Wd*t(i)))+CC*sin(W*t(i))+DD*cos
(W*t(i));
85
upt(i)=CC*W*cos(W*t(i))-DD*W*sin(W*t(i))-AA*exp(-1*ca*Wn*t(i))*(Wd*sin(Wd*t(i))
+ca*Wn*cos(Wd*t(i)))+BB*exp(-1*ca*Wn*t(i))*(Wd*cos(Wd*t(i))-ca*Wn*sin(Wd*t(i)));
86
uto=ut(i);
87
upto=upt(i);
88 end
89 aa=i;
90 for j=1:V2
91
ut(aa+j)=(exp(-ca*Wn*j*Dt))*((uto*cos(Wd*j*Dt)+((upto+ca*Wn*uto)/Wd)*sin
(Wd*j*Dt)));

C:\Users\HOPE\Docume...\InterpolacionExcitacionSenowww.m
Page 3
25 de abril de 2016
11:40:46 AM
92
upt(aa+j)=exp(-ca*Wn*j*Dt)/Wd*(upto*Wd*cos(Wd*j*Dt)-uto*Wd^2*sin(Wd*j*Dt)ca^2*uto*Wn^2*sin(Wd*j*Dt)-ca*upto*Wn*sin(Wd*j*Dt));
93 end
94
95 clear i
96 fprintf('\nTabla E5.1a Solucin Numrica usando Interpolacin Lineal de la Exitacin:
\n');
97 fprintf
('\n=====================================================================================
===================');
98 fprintf('\n
ti
Pi
Cpi
Dpi+1
Bupi
upi
Aui
ui
ut');
99 fprintf('\n
seg
kips\n');
100 fprintf
('=======================================================================================
=================\n');
101 for i=1:n
102
fprintf('%6.3f %11.4f %11.4f %11.4f %11.4f %11.4f %11.4f %11.4f %11.4f\n',t(i,1),
P(i,1),Cpi(i,1),Dpi1(i,1),Bupi(i,1),up(i,1),Aui(i,1),u(i,1),ut(i,1));
103 end
104 fprintf
('-------------------------------------------------------------------------------------------------------\n\n');
105
106 clear i
107 fprintf('\nTabla E5.1b Solucin Numrica usando Interpolacin Lineal de la Exitacin:
\n');
108 fprintf
('\n=====================================================================================
===================');
109 fprintf('\n
ti
Pi
Cpi
Dpi+1
Aui
ui
Bupi
upi
upt');
110 fprintf('\n
seg
kips\n');
111 fprintf
('=======================================================================================
=================\n');
112 for i=1:n
113
fprintf('%6.3f %11.4f %11.4f %11.4f %11.4f %11.4f %11.4f %11.4f %11.4f\n',t(i,1),
P(i,1),Cppi(i,1),Dppi1(i,1),Apui(i,1),u(i,1),Bpupi(i,1),up(i,1),upt(i,1));
114 end
115 fprintf
('-------------------------------------------------------------------------------------------------------\n\n');
116 fprintf('\n\n\n');
117 tetete=['P(t)=Po.Seno(\pi.t/' num2str(DurP) ')'];
118 clear A AA Ap Apui Aui B BB Bp Bpupi Bupi C CC Cp Cpi Cppi D DD Dp Dpi1 Dppi1 uto...
119
Po Tn W Wd Wn a b ca ff i k logo m n uo upto vo xx xx1 y11 y22 V2 az j Datos
120
121 figure('Name','MTODO BASADO EN LA INTERPOLACIN DE LA

C:\Users\HOPE\Docume...\InterpolacionExcitacionSenowww.m
Page 4
25 de abril de 2016
11:40:46 AM
EXITACIN','NumberTitle','off','Color',[1,1,1],'units','normalized','outerposition',[0 0
1 1])
122 %set(gcf,'Color',[1,1,1])%gcf - Obtiene el identificador de la figura actual
123 subplot(2,2,1)
124 axis([min(t) max(t) min(P) max(abs(P))]);
125 xx=linspace(0, DurP, 100);
126 y11=10*sin(pi*xx/DurP);
127 %xx1=linspace(0, Dt, DurP);
128 xx1=(0:Dt:DurP);
129 y22=10*sin(pi*xx1/DurP);
130 plot(xx,y11,'r','linewidth',1)
131 line(xx1, y22,'marker','o')
132 axis([0 Cros min(P) max(P)])
133 xlabel('t, seg')
134 ylabel('P, kips')
135 grid on
136 legend(tetete,'Interpolacin lineal a trozos',1)
137 title('Pulso Sinusoidal de Medio Ciclo','FontSize',22);
138 xlabel('Tiempo','FontSize',9,'FontWeight','bold');
139 ylabel('P(t)','FontSize',9,'FontWeight','bold');
140
141 subplot(2,2,2)
142 axis([min(t) max(t) min(u) max(abs(u))]);
143 plot(t,u,'b','linewidth',1)
144 hold on
145 plot(t,ut,'m')
146 grid on
147 legend('Respuesta Numrica','Respuesta Terica',3)
148 title('Desplazamiento vs Tiempo','FontSize',22);
149 xlabel('Tiempo','FontSize',9,'FontWeight','bold');
150 ylabel('Desplazamiento','FontSize',9,'FontWeight','bold');
151
152 subplot(2,2,3)
153 axis([min(t) max(t) min(up) max(abs(up))]);
154 grid on
155 plot(t,up,'b','linewidth',1)
156 hold on
157 plot(t,upt,'m')
158 grid on
159 legend('Respuesta Numrica','Respuesta Terica',3)
160 title('Velocidad vs Tiempo','FontSize',22);
161 xlabel('Tiempo','FontSize',9,'FontWeight','bold');
162 ylabel('Velocidad','FontSize',9,'FontWeight','bold');
163
164 subplot(2,2,4)
165 logo=imread('pucp1.jpg');
166 imshow(logo)
167 clear xx xx1 y11 y22 logo Cros DurP Dt V1 aa aaaa zzz Tp tetete
168

C:\Users\HOPE\Docume...\InterpolacionExcitacionSenowww.m
Page 5
25 de abril de 2016
11:40:46 AM
169 toc

También podría gustarte