1 / 15

Signals

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

eileenc
Download Presentation

Signals

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Signals

  2. 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

  3. 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

  4. 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 Problem with Binary Files

  5. fid=fopen(fname,’r’);%’r’ = read binary A=fread(fid,N,precision) N=number of data points, use Inf to read everything precision is how the file was created “uint64” is an unsiqned integer saved in 64 bits “double” is a double Reading Binary files

  6. Free advice (you get what you pay for) The only reasons to use binary files are someone gives you one you enjoy frustration and pain you’re too poor (or cheap) to buy a new hard drive

  7. Writing .mat files outside Matlab .mat files are a great format for storing data easy to use with Matlab multiple variables / file compact It is possible to save data to .mat files from C/C++ programs using Matlab C/C++ library For more info: See Lecture 09 notes Take CIS404!

  8. Signals Signals are time series Examples: Sound (pressure vs. time) Earthquake (displacement vs. time) S&P 500 ($/share vs. time) Signals are usually continuous, but we sample them at discrete times regular vs. irregular sampling Sampling frequency

  9. Signal Basics Simplest signal: s(t)=A*sin(2*pi/f*(t-phi)) A=amplitude f=frequency phi=phase A,f,phi summarize signal A phi 1/f

  10. Fourier Analysis Real signals are more complicated Fourier proved that any function can be represented as sum of sines & cosines of various frequencies: f=(k-1)/N

  11. Fourier Analysis f=8 s1(t) s2(t) f=1/2 0.5*s1(t) +s2(t)

  12. 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

  13. 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

  14. 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

  15. Signal Processing Toolbox Matlab’s Signal Processing Toolbox contains lots of functions for working with digital signals transforms beyond fft filter design, implementation spectral analysis Check on-line help for more info Need to understand theory better than I do!

More Related