You are on page 1of 8

%forzada

clear
clc
c=20;
k=4000;
m=10;
wn=sqrt(k/m);
Fo=100;
Xo=Fo/k;
w=5;%rad/seg
%function forzada
fo=Fo/m;
E=c/(2*m*wn);
B=w/wn;
wd=wn*sqrt(1-E^2);
X=fo/(sqrt(1-m*w^2/k)^2+(c*w/k)^2)
fip=atan((2*E*w/wn)/(1-(w/wn)^2))
fipgrados=atand(fip);
%---------------------------------------%F0*cos(w*t)
t=0:0.001:pi/2*w;
Ac=((wn^2-w^2)*fo)/((wn^2-w^2)^2+(2*E*wn*w)^2)
Bc=(2*E*wn*w*fo)/(((wn^2-w^2)^2+(2*E*wn*w)^2))
xpc=Ac.*cos(w*t)+Bc.*sin(w*t);
fic=atan((2*E*wn*w)/(wn^2-w^2))
xpcl=(fo./(sqrt((wn^2-w^2)^2+(2*E*wn*w)^2)))*cos(w*t-fic);
figure(1)
plot(t,xpcl,'r',t,xpc)
%------------------------------------------%Fo=sin(w*t)
Acc=(Fo*(k-m*w^2))/((k-m*w^2)^2+(c*w)^2)
Bcc=-(Fo*c*w)/((k-m*w^2)^2+(c*w)^2)
As=-(2*E*wn*w*fo)/((wn^2-w^2)^2+(2*E*wn*w)^2)
Bs=((wn^2-w^2)*fo)/((wn^2-w^2)^2+(2*E*wn*w)^2)
xps=As*cos(w*t)+Bc*sin(w*t);
xpscc=Bcc*cos(w*t)+Acc*sin(w*t);
fis=atan((c*w)/(k-m*w^2))
XpH=Fo/(sqrt((k-m*w^2)^2+(c*w)^2))*sin(w*t-fis);
XpH1=(Xo/sqrt((1-(B).^2).^2+(2*(E)*(B)).^2))*sin(w*t-fic);
xps1=(fo./(sqrt((wn^2-w^2)^2+(2*E*wn*w)^2)))*sin(w*t-fic);
figure(2)
plot(t,XpH,'r',t,XpH1,t,xps,'k',t,xps1,t,xpscc)
%-----------------------------------------xo=0.25;
vo=0;
EE=sqrt(1-E.^2);
D=X*k/Fo;
D=X*wn^2/fo;
B=0:0.01:pi/2*w;
Ba=(1./sqrt((1-(B).^2).^2+(2*(E)*(B)).^2));
fii=atan((2*E*B)/(1-B.^2));

fiigrados=atand(fii);
figure(3)
plot(B,Ba)
%-----------------------------------------%ver demostracion pag 31 dec1
Sp=sqrt(1-(2*E^2));%B=%el valor max de la amplitud en B=0.9975solo para
razones
%de amortiguamiento menores a 1/1.4142
wp=wn*Sp;%19.9499 la frecuencia de excitacion cuando la amplitud es mas
%la magnitud de la respuesta estacionaria viene dada por
%Xestacionaria=fo.(wn^2*(sqrt((1-(Bea).^2).^2+(2*(E)*(Bea)).^2)))
wp1=sqrt(wn^2-2*E^2);
Xmax=1/(2*E);%amplitud maxima de resonancia
Xmaxzonareson=1/(2*E*(sqrt(1-E^2)));

%respuesta en el tiempo total:parcialmente


xp=X*cos(w*t-fip);
%-----------------------------------------------%respuesta homogeneo para coseno
fiii=atan((wd*(xo-X*cos(fip)))/(vo+E*wn*(xo-X*cos(fip))-w*X*sin(fip)))
A=(xo-X*cos(fip))/(sin(fip))
xhA=A.*exp(-E.*wn.*t).*(sin(wd*t+fiii));
%------------------------------------------------%fihomo=atan((xo*wd)/(vo*E*wn*xo))
%Ah=sqrt(((vo+E*wn*xo)^2+(xo*wd)^2)/wd^2)
%xhomo=(Ah.*exp(-E.*wn.t)).*sin(wd.*t+fihomo)
%
%-----------------------------------------%xh=X1.*exp(exp(-E.*wn.t).*sin(wd*t+fi-))
xtotal=xp+xhA;
figure(4)
plot(t,xps,'r',t,xhA)
figure(5)
plot(t,xps+xhA)
figure(6)
plot(t,xp,t,xhA)
figure(7)
plot(t,xtotal)

%ejemplo de matlab fft


%que podemos corregir a nuestra conveniencia
%vea ffthelp.m
Fs = 1000;
T = 1/Fs;

% Sampling frequency
% Sample time

L = 1000;
% Length of signal
t = (0:L-1)*T;
% Time vector
% Sum of a 50 Hz sinusoid and a 120 Hz sinusoid
x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
y = x + 2*randn(size(t));
% Sinusoids plus noise
figure(1)
plot(Fs*t(1:50),y(1:50))
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('time (milliseconds)')
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(y,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
% Plot single-sided amplitude spectrum.
figure(2)
plot(f,2*abs(Y(1:NFFT/2+1)))
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
programa: ffthelp.m
%con ayuda de help del matlab
Fs=1000;
t=0:1/Fs:0.5;
s1=cos(2*pi*50*t)+sin(2*pi*80*t);
plot(t,s1);
L=length(s1);%longitud de la seal
%vamos a windoow y ponemos doc fft y simplemente incluimos al programa
%la segunda parte
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(s1,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
% Plot single-sided amplitude spectrum.
plot(f,2*abs(Y(1:NFFT/2+1)))
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')

programa:
fourier1.m
clear all
t = 0:0.001:1;
%y = 2/3*cos(8*t)-1/6*sin(8*t);
y=sin(2*pi*50*t)+cos(2*pi*20*t);
figure (1)
plot(t,y)
plot(1000*t(1:50),y(1:50))
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('time (milliseconds)')
Y = fft(y,256);
%The power spectrum, a measurement of the power at various frequencies,
is
Pyy = Y.* conj(Y) / 256;
%Graph the first 257 points (the other 255 points are redundant) on a
meaningful frequency axis:

f = 1000*(0:128)/256;
figure(2)
plot(f,Pyy(1:129))
title('Frequency content of y')
xlabel('frequency (Hz)')
programa:
fffff.m
%Ejemplo: Sea f(t) el tren de pulsos de ancho p y periodo T.
%La versin muestreada f(k) de f(t) slo puede tomar un nmero finito
%de puntos. Tomemos por ejemplo N=32 puntos cuidando que cubran el
%intervalo de 0 a T (con p=1, T=2):

N=32
k=0:31
f=((k<8)|(k>23))
figure (1)
plot(k,f,'o')
%Con los 32 puntos f(k) calculamos F(n) mediante la FFT, por ejemplo,
%en Matlab:
%F=fft(f)/N;
%Con lo que obtenemos 32 valores complejos de F(n).
%Estos valores son los coeficientes de la serie compleja ordenados
%como sigue:
F=fft(f)/N;
%Podemos graficar el espectro de amplitud reordenando previamente F(n)
%como sigue
%aux=F;
%F(1:16)=aux(17:32);
%F(17:32)=aux(1:16);
aux=F;
F(1:16)=aux(17:32);
F(17:32)=aux(1:16);
%Y para graficar el espectro de amplitud:
%stem(abs(F))
figure (2)
stem(abs(F))
%Si deseamos una escala horizontal en unidades de frecuencia (rad/seg):
T=2
wo=2*pi/T;
n=-16:15;
w=n*wo;
figure (3)
stem(w,abs(F))

%transmisibilidad
%thomson rao
clear, clc, clf
m=100;%
w=30;%rad/seg
k=350;%Nm
c=30;
F0=34;
wn=sqrt(k/m);
cc=2*m*wn;
E=c/cc;
E1=0.1;
E2=0.4;
E3=0.75;
wn=sqrt(k/m);
%r=w/wn;
B=0:0.001:2;
X=(F0/k)/sqrt((1-m*w^2/k)^2+(c*w/k)^2);
Ft=k*X*sqrt(1+(c*w/k)^2);
%Tr=Ft/F0;
Tr=(sqrt(1+(2*E*B).^2))./(sqrt((1-B.^2).^2+(2.*E.*B).^2));
Tr1=(sqrt(1+(2*E1*B).^2))./(sqrt((1-B.^2).^2+(2.*E1.*B).^2));
Tr2=(sqrt(1+(2*E2*B).^2))./(sqrt((1-B.^2).^2+(2.*E2.*B).^2));
Tr3=(sqrt(1+(2*E3*B).^2))./(sqrt((1-B.^2).^2+(2.*E3.*B).^2));
%Tr=((1+(2*E*r)^2)/((1-r^2)^2+(2*E*r)^2))^0.5;
figure(1)
plot(B,Tr,B,Tr1,B,Tr2,B,Tr3)
grid on

%DESBALANCE ROTATORIO MAQUINA DESBALANCEADA


%THOMSON PAG 53 teoria
clear,clc,clf
m=4; %
M=30; %
w=2;% rad/seg
k=50;% Nm
e=0.01;
c=10;
wn=sqrt(k/(M))
E=c/(2*M*wn)
B=w/wn
B1=w*sqrt(M/k);
fi=(atan((2.*E.*B)/(1-(B.^2))));
Fo=(m*e*w^2);
Xo=Fo/k
Ba=(1/(sqrt((1-B^2)^2+(2*E*B)^2)));

B2=B^2;
Br=B2*Ba%resonancia si se iguala w=wn
%A,D,D1 son iguale y es la amplitud de la respuesta particular
A=(m*e/M)*Br
FAT=(m*e*(w^2/k))/(sqrt((1-B^2)+(2*E*B)^2))
D1=(e*m*B^2)/(M*(sqrt((1-(B).^2).^2+(2.*(E).*(B)).^2)))
X=(m*e*w^2)/(sqrt((k-M*w^2)^2+(c*w)^2))
Xr=(m*e/M)*Br
Breso=(Xr*M/m*e)
B=0:0.001:5;
FAT=(B.^2)./(sqrt((1-(B).^2).^2+(2.*(E).*(B)).^2));
figure(1)
plot(B,FAT)
grid
FAD=M*X/m*e
t=0:0.001:25;
EE=sqrt(1-E^2);
wd=EE*wn;
wr=sqrt(wn^2-(c^2/2*m^2));
vo=0;
xo=0;
%--------------------------------------------------%respuesta homogenea para cos RAO
%X1=sqrt((xo-Xcos(fi))^2+(1/wd^2)*(E*wn*xo+vo-E*wn*X*cos(fi)w*X*sin(fi))^2
%fih=atan(((E.wn.*xo)+vo-(E.*wn.*X.*cos(fi))-(w.*X.sin(fi)))/(wd.*(xoX*cos
%fiogrados=atand(fih)
%fihomo=atan((-EE*sin(fi))./(E*sin(fi)-(w/wn)*cos(fi)))
%xh=X1.*axp(-E.*wn.*t).*(sin(wd*t*fih));
%--------------------------------------------------%respuesta homogenea para cos
fiii=atan((wd*(xo-X*cos(fi)))/(vo+E*wn*(xo-X*cos(fi))-w*X*sin(fi)))
A=(xo-X*cos(fi))/(sin(fiii))
xhA=A.*exp(-E.*wn.*t).*(sin(wd*t+fiii));
%----------------------------------------------------xp1=D1*sin(w.*t-fi);
xp2=Xo*Ba*sin(w.*t-fi);
xp3=(m*e/M)*Br*sin(w.*t-fi);
x=xhA+xp3;
figure(2)
plot(t,xhA)
grid
figure(3)
plot(t,xp1,t,xp2,'r',t,xp3)
grid
figure(4)
plot(t,x)
grid

%SISTEMA MASA RESORTE SI AMORTIGUAMIENTO EXCITADO ARMONICAMENTE.


clear
clc
k=4000;
%N/m
m=10;
%kg
t=0:0.01:1;
%seg
w=30;
%rad/seg
Fo=400;
%F(t)=Fo*cos(w*t)
%ma+kx=Fo*cos(w*t)
wn=sqrt(k/m);
%rad/seg
fo=Fo/m;
X=fo/(wn^2-w^2);
xst=Fo/k;
B=w/wn;
%RELACION DE FRECUENCIAS
R=X/xst;
%RELACION O FACTOR DE AMPLITUD
Xmax=abs(xst./(1-(w/wn).^2));
B=0:0.01:2;
R=1./(1-B.^2);
%CONDICONES
xo=0.1;
vo=0.1;
%SOLUCION PATICULAR
xp=X*cos(w*t);
%SOLUCION HOMOGENEA
xh=(vo/wn)*sin(wn*t)+(xo-(fo/(wn^2-w^2)))*cos(wn*t);
Xh=sqrt((vo/wn)^2+(xo-(fo/(wn^2-w^2)))^2);
%SOLUCION TOTAL
xt=(vo/wn)*sin(wn*t)+(xo-(fo/(wn^2-w^2)))*cos(wn*t)+(fo/(wn^2w^2))*cos(w*t);
%RESONANACIA w=wn
xtre=(vo/w).*sin(w.*t)+xo.*cos(w.*t)+(fo/2*w).*t.*sin(w.*t);
%PULSACIONES w1 y wn1 son casi iguales
w=30;
wn=20;
E=(w-wn)/2;
xpul=(Fo/2*E*w)*[sin(E.*t)].*sin(w.*t);
figure(1)
plot(t,xp,'b')
grid on
title ('TIEMPO vs xp','fontsize',30)
xlabel('TIEMPO','fontsize',15)
ylabel('Solucion particular','fontsize',15)
figure(2)
plot(t,xh,'g')
grid on
title ('TIEMPO vs xh','fontsize',30)

xlabel('TIEMPO','fontsize',15)
ylabel(' Solucion homogenea','fontsize',15)
figure(3)
plot(t,xp,t,xh)
grid on
title ('TIEMPO vs (xp, xh)','fontsize',30)
xlabel('TIEMPO','fontsize',15)
ylabel('xp xh','fontsize',15)
figure(4)
plot(t,xt)
grid on
title ('t vs xt','fontsize',30)
xlabel('tiempo','fontsize',15)
ylabel('Solucion total','fontsize',15)
figure(5)
plot(B,R,'b')
grid on
title ('B vs R','fontsize',30)
xlabel('RELACION DE FRECUENCIAS','fontsize',15)
ylabel('RELACION DE AMPLITUDES','fontsize',15)
figure(6)
plot(t,xpul)
grid on
title ('tiempo vs pulsaciones','fontsize',30)
xlabel('tiempo','fontsize',15)
ylabel('pulsaciones','fontsize',15)

You might also like