Attachment 'sempr2.m'

Download

   1 clc;
   2 clear all;
   3 close all;
   4 format long;
   5 
   6 % Nacteni signalu
   7 [i,fs,b] = wavread('Sound.wav');
   8 N = length(i);
   9 figure; stem((0:length(i)-1)/fs,i,'.');
  10 title('Vstupni signal');
  11 xlabel('t[s]');
  12 ylabel('s(t)');
  13 grid on;
  14 
  15 % Nacteni filtru
  16 f = dlmread('filtr.dat', '\n');
  17 figure; stem((0:length(f)-1)/fs,f);
  18 title('Impulzova odezva filtru');
  19 xlabel('t[s]');
  20 ylabel('s(t)');
  21 grid on;
  22 
  23 % Konvoluce
  24 o = conv(i, f);
  25 wavwrite(o, fs, b, 'vystup.wav');
  26 figure; stem((0:length(o)-1)/fs,o,'.');
  27 title('Vystupni signal');
  28 xlabel('t[s]');
  29 ylabel('s(t)');
  30 grid on;
  31 
  32 % Spektrum vstupniho signalu
  33 is = fftshift(fft(i));
  34 figure; stem((-length(is)/2:length(is)/2-1)*fs/length(i),abs(is),'.');
  35 title('Spektrum vstupniho sugnalu');
  36 xlabel('f[Hz]');
  37 ylabel('S(f)');
  38 
  39 % Spektrum vystupniho signalu
  40 os = fftshift(fft(o));
  41 figure; stem((-length(os)/2:length(os)/2-1)*fs/length(o),abs(os),'.');
  42 title('Spektrum vystupniho signalu');
  43 xlabel('f[Hz]');
  44 ylabel('S(f)');
  45 
  46 % Energie vstupu a vystupu
  47 Ein = sumsqr(i)
  48 Eout = sumsqr(o)
  49 
  50 return;

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2005-05-25 12:52:55, 15.2 KB) [[attachment:2_P010-3.pdf]]
  • [get | view] (2005-05-25 12:53:26, 54.2 KB) [[attachment:Sound.wav]]
  • [get | view] (2005-05-27 09:51:57, 1.1 KB) [[attachment:f-e.png]]
  • [get | view] (2005-05-27 09:57:56, 3.0 KB) [[attachment:f-four.png]]
  • [get | view] (2005-05-25 12:59:25, 0.8 KB) [[attachment:filtr.dat]]
  • [get | view] (2005-05-26 10:20:30, 6.7 KB) [[attachment:imp.png]]
  • [get | view] (2005-05-26 10:20:38, 4.9 KB) [[attachment:in-s.png]]
  • [get | view] (2005-05-26 10:20:35, 12.5 KB) [[attachment:in.png]]
  • [get | view] (2005-05-26 10:20:47, 6.8 KB) [[attachment:out-s.png]]
  • [get | view] (2005-05-26 10:20:43, 8.4 KB) [[attachment:out.png]]
  • [get | view] (2005-05-26 10:27:35, 1.0 KB) [[attachment:sempr2.m]]
  • [get | view] (2005-05-25 12:53:35, 54.1 KB) [[attachment:vystup.wav]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.