1 Signals Outline • Announcements: – Homework III: due Today by 5, by e-mail • for P.4: n can be anything you want – HW IV available soon. • Binary Files • Signals, signals, signals Binary Basics • All computer files are “binary”, that is composed of 0’s and1’s • When the computer reads ASCII files, it takes chunks of 8 bits (1 byte) and looks up the character • To save pi to 16 digits takes 18 bytes in ASCII • If you save the 1’s and 0’s that correspond to the double precision value of pi, that takes only 8 bytes
5
Embed
Signals - Cornell University•Binary Files •Signals, signals, signals Binary Basics •All computer files are “binary”, that is composed of 0’s and1’s •When the computer
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1
Signals
Outline
• Announcements:– Homework III: due Today by 5, by e-mail
• for P.4: n can be anything you want
– HW IV available soon.
• Binary Files• Signals, signals, signals
Binary Basics
• All computer files are “binary”, that is composed of 0’sand1’s
• When the computer reads ASCII files, it takes chunks of8 bits (1 byte) and looks up the character
• To save pi to 16 digits takes 18 bytes in ASCII• If you save the 1’s and 0’s that correspond to the
double precision value of pi, that takes only 8 bytes
2
• You can’t just look at them• You must know exactly how they were
created– integers vs. floating point– single precision vs. double precision– signed vs. unsigned
• Real signals are more complicated• Fourier proved that any function can be
represented as sum of sines & cosines ofvarious frequencies:
f=(k-1)/N
Fourier Analysis
s1(t)
s2(t)
0.5*s1(t)+s2(t)
f=8
f=1/2
Signals in MATLAB
• In MATLAB, a signal is a vector of numbers s• Matlab’s signal processing functions assume
– s was sampled regularly– s is complete (no missing data, nans, -999’s etc.)
• You must know sampling frequency f
5
Fourier Analysis
• Fourier transform (fft)– Finds amplitudes over a range of frequencies
• amp=fft(s);
– If s is n-by-1, amp will be n-by-1 and complex•
– First half of amp contains info:• a=real([amp(1),2*amp(2:n/2)])/n; %cos coefs.• b=imag([0, -2*amp(2:n/2)])/n; %sin coefs.• f= (0:(n/2-1))/n/(t(2)-t(1)); %frequencies• F=2*pi*t(:)*f;• s2=cos(F)*a(:)+sin(F)*b(:); %original signal
Fourier Analysis
• What’s the point?– fft transforms from time-domain to
frequency domain• Energy at frequency j = sqrt(a(j).^2+b(j).^2)• Plot energy vs. f• Peaks are important f’s• Could remove energy at some frequencies
Signal Processing Toolbox
• Matlab’s Signal Processing Toolboxcontains lots of functions for workingwith digital signals– transforms beyond fft– filter design, implementation– spectral analysis– Check on-line help for more info– Need to understand theory better than I