Professional Documents
Culture Documents
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)));
% 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
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
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)