Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N=100;
- A1=50;
- A2=100;
- A3=150;
- f1=50;%częstotliwosc sygnału
- f2=100;
- f3=150;
- fs=1000;
- n1=[1:N];
- ff=(0:N-1)*fs/N;
- tn=n1/fs;
- xs=A1*sin(2*pi*f1*tn)+A2*sin(2*pi*f2*tn)+A3*sin(2*pi*f3*tn);
- for k=1:1
- for n=1:N
- A(1,n)=sqrt(1/N)*cos((pi*k/N)*(n+0.5));
- end
- end
- for k=2:N
- for n=1:N
- A(k,n)=sqrt(2/N)*cos(pi*k/N*(n+0.5));
- end
- end
- S=inv(A);
- y=A*xs';
- figure(1);
- for k=1:N
- plot(A(k,:),'b');
- plot(S(:,k),'r');
- pause(0.1);
- end
- figure(2);
- plot(ff,abs(y(1:N)),'b');
- xr=S*y;
- figure(3);
- hold on;
- plot(xs,'b');
- plot(xr,'r');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement