Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- close all;
- clear all;
- N=100;
- A = zeros(N, N);
- for n=0:N-1
- for k=0:N-1
- if k == 0
- s = sqrt(1/N) ;
- else
- s = sqrt(2/N);
- end
- A(k+1, n+1) = s*cos(pi*k/N*(n+0.5));
- end
- end
- S = A';
- fp = 1000;%czestotliwosc probkowania
- czas = N/fp;%czas przez jaki próbkujemy, #DEPRECATED#
- t=0:N-1;%ilość próbek
- t = t/fp;%przerobienie wektora na czas
- f1 = 50;%52.5;
- f2 = 100;%102.5;
- f3 = 150;%152.5;
- A1 = 50;
- A2 = 100;
- A3 = 150;
- x = A1*sin(2*pi*f1*t) + A2*sin(2*pi*f2*t) + A3*sin(2*pi*f3*t);
- plot(x)
- pause
- y=A*x';
- figure()
- plot(1:N, abs(y), '-');%1:N, x);
- title('Sygnał w zależności od numeru próbki');
- figure();
- plot((0:N-1)*fp/(2*N), abs(y), '-');
- title('Sygnał w zależności od nr próbki przeskalowanej na czestotliwosc');
- % figure();
- % plot(t, y);
- xs = S*y;
- blad_rekonstrukcji=max(abs(xs-x'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement