Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %%dane
- f = [0:0.5:600];
- m1 = 70;
- m2 = 40;
- m3 = 50;
- m4 = 40;
- k1 = 3*10^6;
- k2 = 1*10^6;
- k3 = 2*10^6;
- k4 = 1*10^6;
- k5 = 0.5*10^6;
- h1 = 300;
- h2 = 100;
- h3 = 200;
- h4 = 100;
- h5 = 50;
- %%macierze M, H, K
- M=[m1,0,0,0;
- 0,m2,0,0;
- 0,0,m3,0;
- 0,0,0,m4];
- H=[h1+h2+h4,-h2,0,-h4;
- -h2,h2+h3,-h3,0;
- 0,-h3,h3+h5,-h5;
- -h4,0,-h5,h4+h5];
- K=[k1+k2+k4,-k2,0,-k4;
- -k2,k2+k3,-k3,0;
- 0,-k3,k3+k5,-k5;
- -k4,0,-k5,k4+k5];
- T = 2 *pi *f;
- [n,m]=size(T);
- W11=[];
- W12=[];
- W13=[];
- W14=[];
- W21=[];
- W22=[];
- W23=[];
- W24=[];
- W31=[];
- W32=[];
- W33=[];
- W34=[];
- W41=[];
- W42=[];
- W43=[];
- W44=[];
- ; % częstość kołowa
- f=[0:0.01:150];
- for w =2*pi*f
- W=(K-(w^2)*M+(1i)*w*H)^(-1);
- W11=[W11; W(1,1)];
- W12=[W12; W(1,2)];
- W13=[W13; W(1,3)];
- W14=[W14; W(1,4)];
- W21=[W21; W(2,1)];
- W22=[W22; W(2,2)];
- W23=[W23; W(2,3)];
- W24=[W24; W(2,4)];
- W31=[W31; W(3,1)];
- W32=[W32; W(3,2)];
- W33=[W33; W(3,3)];
- W34=[W34; W(3,4)];
- W41=[W41; W(4,1)];
- W42=[W42; W(4,2)];
- W43=[W43; W(4,3)];
- W44=[W44; W(4,4)];
- end
- mod_W11=abs(W11);
- mod_W12=abs(W12);
- mod_W13=abs(W13);
- mod_W14=abs(W14);
- mod_W21=abs(W21);
- mod_W22=abs(W22);
- mod_W23=abs(W23);
- mod_W24=abs(W24);
- mod_W31=abs(W31);
- mod_W32=abs(W32);
- mod_W33=abs(W33);
- mod_W34=abs(W34);
- mod_W41=abs(W41);
- mod_W42=abs(W42);
- mod_W43=abs(W43);
- mod_W44=abs(W44);
- %widmo amplitudowe
- figure(1);
- subplot;
- plot(f,mod_W11,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W_1_1')
- grid
- figure(1);
- subplot;
- plot(f,mod_W12,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W12')
- grid;
- subplot;
- plot(f,mod_W13,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W13')
- grid;
- subplot;
- plot(f,mod_W14,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W14')
- grid;
- figure(2);
- subplot;
- plot(f,mod_W21,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W21')
- grid;
- subplot;
- plot(f,mod_W22,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W22')
- grid;
- subplot;
- plot(f,mod_W23,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W23')
- grid;
- subplot;
- plot(f,mod_W24,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W24')
- grid;
- figure(3);
- subplot;
- plot(f,mod_W31,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W31')
- grid;
- subplot;
- plot(f,mod_W32,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W32')
- grid;
- subplot;
- plot(f,mod_W33,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W33')
- grid;
- subplot;
- plot(f,mod_W34,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W34')
- grid;
- figure(4);
- subplot;
- plot(f,mod_W41,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W41')
- grid;
- subplot;
- plot(f,mod_W42,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W42')
- grid;
- subplot;
- plot(f,mod_W43,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W43')
- grid;
- subplot;
- plot(f,mod_W44,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W44')
- grid;
- % fazy
- faza_W11=angle(W11);
- faza_W12=angle(W12);
- faza_W13=angle(W13);
- faza_W14=angle(W14);
- faza_W21=angle(W21);
- faza_W22=angle(W22);
- faza_W23=angle(W23);
- faza_W24=angle(W24);
- faza_W31=angle(W31);
- faza_W32=angle(W32);
- faza_W33=angle(W33);
- faza_W34=angle(W34);
- faza_W41=angle(W41);
- faza_W42=angle(W42);
- faza_W43=angle(W43);
- faza_W44=angle(W44);
- %widmo fazowe
- figure(5);
- subplot;
- plot(f,faza_W11,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W_1_1');
- grid;
- subplot;
- plot(f,faza_W12,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W_1_2 ');
- grid;
- subplot;
- plot(f,faza_W13,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W_1_3');
- grid;
- subplot;
- plot(f,faza_W14,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W_1_4 ');
- grid;
- figure(6);
- subplot;
- plot(f,faza_W21,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W_2_1[\circ]');
- grid;
- subplot;
- plot(f,faza_W22,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W_2_2');
- grid;
- subplot;
- plot(f,faza_W23,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W_2_3');
- grid;
- subplot;
- plot(f,faza_W24,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W_2_4');
- grid;
- figure(7);
- subplot;
- plot(f,faza_W31,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('phi_3_1[\circ]');
- grid;
- subplot;
- plot(f,faza_W32,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('phi_3_2[\circ]');
- grid;
- subplot;
- plot(f,faza_W33,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W_3_3');
- grid;
- subplot;
- plot(f,faza_W34,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W_3_4');
- grid;
- figure(8);
- subplot;
- plot(f,faza_W41,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('phi_4_1[\circ]');
- grid;
- subplot;
- plot(f,faza_W42,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('phi_4_2[\circ]');
- grid;
- subplot;
- plot(f,faza_W43,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('phi_4_3[\circ]');
- grid;
- subplot;
- plot(f,faza_W44,'b-','LineWidth',2);
- xlabel('f[Hz]');
- ylabel('W_4_4');
- grid;
- %Częstotliwościowa funkcja przejścia
- RW11=real(W11);
- IW11=imag(W11);
- RW12=real(W12);
- IW12=imag(W12);
- RW13=real(W13);
- IW13=imag(W13);
- RW14=real(W14);
- IW14=imag(W14);
- RW21=real(W21);
- IW21=imag(W21);
- RW22=real(W22);
- IW22=imag(W22);
- RW23=real(W23);
- IW23=imag(W23);
- RW24=real(W24);
- IW24=imag(W24);
- RW31=real(W31);
- IW31=imag(W31);
- RW32=real(W32);
- IW32=imag(W32);
- RW33=real(W33);
- IW33=imag(W33);
- RW34=real(W34);
- IW34=imag(W34);
- RW41=real(W41);
- IW41=imag(W41);
- RW42=real(W42);
- IW42=imag(W42);
- RW43=real(W43);
- IW43=imag(W43);
- RW44=real(W44);
- IW44=imag(W44);
- figure(9);
- subplot;
- plot(RW11,IW11,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- subplot;
- plot(RW12,IW12,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- subplot;
- plot(RW13,IW13,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- subplot;
- plot(RW14,IW14,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- figure(10);
- subplot;
- plot(RW21,IW21,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- subplot;
- plot(RW22,IW22,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- subplot;
- plot(RW23,IW23,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- subplot;
- plot(RW24,IW24,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- figure(11);
- subplot;
- plot(RW31,IW31,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- subplot;
- plot(RW32,IW32,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- subplot;
- plot(RW33,IW33,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- subplot;
- plot(RW34,IW34,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- figure(12);
- subplot;
- plot(RW41,IW41,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- subplot;
- plot(RW42,IW42,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- subplot;
- plot(RW43,IW43,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- subplot;
- plot(RW44,IW44,'b-','LineWidth',2);
- xlabel('Re(Gjw)');
- ylabel('IM(Gjw)');
- grid;
- %postacie drgań
- A=(M^-1)*K;
- [U,w]=eig(A);
- omega=sqrt(diag(w)); % rad/s
- freq=omega/(2*pi); %Hz
- %blok 1
- x1=[0,80,80,30,30,0];
- y1=[0,0,30,30,65,65];
- %blok 2
- x2=[0,35,35,0];
- y2=[0,0,30,30];
- %blok 3
- x3=[0,65,65,75,75,0];
- y3=[0,0,-20,-20,30,30];
- %blok4
- x4=[0,50,50,0];
- y4=[0,0,35,35];
- %odległości bloków od osi
- dx1=15;
- dx2=60;
- dx3=115;
- dx4=115;
- dy1=5;
- dy2=40;
- %położenie początku układów osi każdego bloku
- X1=x1+dx1;
- X2=x2+dx2;
- X3=x3+dx3;
- X4=x4+dx4;
- Y1=y1+dy1;
- Y2=y2+dy2;
- Y3=y3+dy2;
- Y4=y4;
- %rysowanie obiektów
- figure(13);
- axis([0,200,0,80]); % wartości długości osi X i Y
- hold on %zatrzymaj wykres
- blok1=fill(X1,Y1,'m');
- blok2=fill(X2,Y2,'k');
- blok3=fill(X3,Y3,'c');
- blok4=fill(X4,Y4,'r');
- %animacja
- %parametry animacji
- lbkd=10; %liczba kadr
- lbpow=30; %liczba powtórzeń
- wzmoc=12; %współczynnik wzmocninia
- nrpost=4; %numer animowanej postaci
- grid
- % generowanie animacji (filmu)
- k=3
- X1=x1+dx1+wzmoc*U(1,nrpost)*sin((k-1)*2*pi/lbkd);
- X2=x2+dx2+wzmoc*U(2,nrpost)*sin((k-1)*2*pi/lbkd);
- X3=x3+dx3+wzmoc*U(3,nrpost)*sin((k-1)*2*pi/lbkd);
- X4=x4+dx4+wzmoc*U(4,nrpost)*sin((k-1)*2*pi/lbkd);
- set(blok1,'Xdata',X1);
- set(blok2,'Xdata',X2);
- set(blok3,'Xdata',X3);
- set(blok4,'Xdata',X4);
- F(k)=getframe;
- movie(F,lbpow);
- %zapis video
- %video = VideoWriter('amicacja_drgań_2.avi','Uncompressed AVI');
- %video.FrameRate = 15;
- %open(video);
- %writeVideo(video,F);
- %close(video);
- %postacie drgań
- [U,w]==eig(inv(M)*K);
- w=sqrt([w(1,1);w(2,2);w(3,3);w(4,4)])/(2*pi);
- kp=10000;
- %kv=1000;
- kv=2*sqrt(kp);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement