10. ura (plan): obdelava signala

forum v pomoč delavnici UR
Post Reply
alesB
Site Admin
Posts: 33
Joined: Tue Jul 12, 2022 8:43 am

10. ura (plan): obdelava signala

Post by alesB »

Naredili bomo najbolj osnovno obdelavo signala.

Kot primer bomo vzeli signal, ki je vsota sinusnih signalov treh frekvenc.
Ena je visoka, relativno majhne amplitude, zato njen prispevek izgleda kot motnja.

Postopek je naslednji: signal (s FFT) pretvorimo v spekter, spekter popravimo in
transformiramo nazaj (z IFFT) v popravljen signal.

Primer je na sliki spodaj:
bb.png
bb.png (210.93 KiB) Viewed 74 times
lpa
alesB
Site Admin
Posts: 33
Joined: Tue Jul 12, 2022 8:43 am

Re: 10. ura (plan): obdelava signala

Post by alesB »

Code: Select all

# Octave 4.2.2, Mon Feb 13 18:06:01 2023 CET <ales@piko>
clc
uu=sigsum([1,2,3],[30,50,60],[0,0,0])
fs=1000;
ts=2;
tt=0:1/fs:(ts-1/fs);
uu=sigsum(tt,[1,2,3],[30,50,60],[0,0,0]);
uu
uu=sigsum(tt,[1,2,3],[30,50,60],[0,0,0]);
[tt,uu]
[tt;uu]
[tt;uu]'
[tt;uu]'
uu=sigsum(tt,[1,2,3],[30,50,60],[0,0,0]);
[tt;uu]'
plot(tt,uu)
plot(tt,uu,"linewidth",3);grid;
plot(tt(1:100),uu(1:100),"linewidth",3);grid;
plot(tt(1:100),uu(1:100),"linewidth",3);grid;
AA
uu=sigsum(tt,[1,2,3],[30,50,60],[0,0,0]);
fftuu=fft(uu);
bar(fftuu);grid;
bar(abs(fftuu));grid;
bar(abs(fftuu));
bar(abs(fftuu))
fftuu
abs(fftuu)>200
find(abs(fftuu)>200)
bar(abs(fftuu),"linewidth",3)
bar(abs(fftuu),"linewidth",3);grid;
bar(abs(fftuu)(1:100),"linewidth",3);grid;
bar(abs(fftuu)(1:500),"linewidth",3);grid;
bar(abs(fftuu)(1:300),"linewidth",3);grid;
bar(abs(fftuu)(1:200),"linewidth",3);grid;
ff=0:1/ts:(fs-1/ts);
bar(abs(fftuu)(1:300),"linewidth",3);grid;
bar(ff(1:200),abs(fftuu)(1:200),"linewidth",3);grid;
uu=sigsum(tt,[1,2,3],[30,50,60],[0,0,0]);
uu=sigsum(tt,[1,0.8,0.9,0.2],[30,50,60,533],[0,0,0]);
uu=sigsum(tt,[1,0.8,0.9,0.2],[30,50,60,533],[0,0,0,0]);
plot(tt(1:100),uu(1:100),"linewidth",3);grid;
plot(tt(1:200),uu(1:200),"linewidth",3);grid;
uu=sigsum(tt,[1,0.8,0.9,0.3],[30,50,60,533],[0,0,0,0]);
plot(tt(1:200),uu(1:200),"linewidth",3);grid;
fftuu=fft(uu);
bar(abs(fftuu)(1:300),"linewidth",3);grid;
plot(tt(1:200),uu(1:200),"linewidth",3);grid;
bar(ff(1:200),abs(fftuu)(1:200),"linewidth",3);grid;
bar(ff(1:700),abs(fftuu)(1:700),"linewidth",3);grid;
bar(ff(1:700),abs(fftuu)(1:800),"linewidth",3);grid;
bar(ff(1:800),abs(fftuu)(1:800),"linewidth",3);grid;
bar(ff(1:1000),abs(fftuu)(1:1000),"linewidth",3);grid;
bar(ff(1:1200),abs(fftuu)(1:1200),"linewidth",3);grid;
fs=10000;
ts=2;
tt=0:1/fs:(ts-1/fs);
ff=0:1/ts:(fs-1/ts);
uu=sigsum(tt,[1,0.8,0.9,0.3],[30,50,60,533],[0,0,0,0]);
plot(tt(1:200),uu(1:200),"linewidth",3);grid;
plot(tt(1:1000),uu(1:1000),"linewidth",3);grid;
plot(tt(1:2000),uu(1:2000),"linewidth",3);grid;
fftuu=fft(uu);
bar(ff(1:1200),abs(fftuu)(1:1200),"linewidth",3);grid;
bar(ff(1:12000),abs(fftuu)(1:12000),"linewidth",3);grid;
bar(ff(1:22000),abs(fftuu)(1:22000),"linewidth",3);grid;
bar(ff(1:20000),abs(fftuu)(1:20000),"linewidth",3);grid;
bar(ff(1:1200),abs(fftuu)(1:1200),"linewidth",3);grid;
find(abs(fftuu)>2000)
fft2=fftuu;
fft2(1067)=0;
bar(ff(1:1200),abs(fft2)(1:1200),"linewidth",3);grid;
bar(ff(1:1200),abs(fftuu)(1:1200),"linewidth",3);grid;
bar(ff(1:1200),abs(fft2)(1:1200),"linewidth",3);grid;
uu2=ifft(fft2);
uu2
uu2'
plot(tt(1:2000),real(uu2)(1:2000),"linewidth",3);grid;
find(abs(fft2)>2000)
fft2(18935)=0;
uu2=ifft(fft2);
plot(tt(1:2000),real(uu2)(1:2000),"linewidth",3);grid;
plot(tt(1:2000),real(uu)(1:2000),"linewidth",3);grid;
plot(tt(1:2000),real(uu2)(1:2000),"linewidth",3);grid;
plot(tt(1:2000),real(uu)(1:2000),"linewidth",3);grid;
plot(tt(1:2000),real(uu2)(1:2000),"linewidth",3);grid;
plot(tt(1:2000),real(uu)(1:2000),"linewidth",3);grid;
plot(tt(1:2000),real(uu2)(1:2000),"linewidth",3);grid;
help save
help history_save 
help history
quit
# Octave 4.2.2, Mon Feb 20 17:45:14 2023 CET <ales@piko>
Post Reply