Linear Interpolation. Linear interpolation Linear interpolation is using a straight line connecting...
-
Upload
alexina-atkins -
Category
Documents
-
view
220 -
download
0
description
Transcript of Linear Interpolation. Linear interpolation Linear interpolation is using a straight line connecting...
![Page 1: Linear Interpolation. Linear interpolation Linear interpolation is using a straight line connecting two data points to predict any data point in between.](https://reader036.fdocuments.in/reader036/viewer/2022082419/5a4d1b3e7f8b9ab05999ffa4/html5/thumbnails/1.jpg)
Linear Interpolation
![Page 2: Linear Interpolation. Linear interpolation Linear interpolation is using a straight line connecting two data points to predict any data point in between.](https://reader036.fdocuments.in/reader036/viewer/2022082419/5a4d1b3e7f8b9ab05999ffa4/html5/thumbnails/2.jpg)
Linear interpolation• Linear interpolation is using
a straight line connecting two data points to predict any data point in between. Thus:
Therefore:
It is important to note that extrapolation is generally not reliable.
![Page 3: Linear Interpolation. Linear interpolation Linear interpolation is using a straight line connecting two data points to predict any data point in between.](https://reader036.fdocuments.in/reader036/viewer/2022082419/5a4d1b3e7f8b9ab05999ffa4/html5/thumbnails/3.jpg)
IDL intrinsic functions for linear interpolation
• Linear interpolation y2 = interpol(y, x, x2)
where x and y are the original time series x2 is the desired x coordinate for the new data points y2 is the resultant y coordinate for the new data points
![Page 4: Linear Interpolation. Linear interpolation Linear interpolation is using a straight line connecting two data points to predict any data point in between.](https://reader036.fdocuments.in/reader036/viewer/2022082419/5a4d1b3e7f8b9ab05999ffa4/html5/thumbnails/4.jpg)
Example x = [0.01, 0.12, 0.23, 0.31, 0.4, 0.52, 0.6, 0.74, 0.8, 0.9, 0.95] y = [0.02, 0.01, 0.04, 0.03, 0.05, 0.06, 0.05, 0.08, 0.12, 0.09, 0.10]
x2=findgen(19)*0.05+0.05 print, x2
y2=interpol(y, x, x2) print, y2
plot, x, y, psym=2, symsize=2.0 oplot, x, y oplot, x2, y2, psym=5, symsize=2.0 end
![Page 5: Linear Interpolation. Linear interpolation Linear interpolation is using a straight line connecting two data points to predict any data point in between.](https://reader036.fdocuments.in/reader036/viewer/2022082419/5a4d1b3e7f8b9ab05999ffa4/html5/thumbnails/5.jpg)
Graphic devices• Commonly used graphic devices: WIN, MAC, X, PS• Select a graphic device set_plot, device_name (‘X’ or ‘PS’)
• Close a device device, /close device, /close_file
![Page 6: Linear Interpolation. Linear interpolation Linear interpolation is using a straight line connecting two data points to predict any data point in between.](https://reader036.fdocuments.in/reader036/viewer/2022082419/5a4d1b3e7f8b9ab05999ffa4/html5/thumbnails/6.jpg)
Configure the graphic device• Syntax: device, keywords• Keep windows (for X windows): device, retain=2
• Select color model device, decomposed=0 (for indexed color, recommended) 1 (for decomposed color) IDL has two color models indexed color: 28 colors, used mostly with both 8-bit decomposed color: 224 colors used mostly with 24-bit
![Page 7: Linear Interpolation. Linear interpolation Linear interpolation is using a straight line connecting two data points to predict any data point in between.](https://reader036.fdocuments.in/reader036/viewer/2022082419/5a4d1b3e7f8b9ab05999ffa4/html5/thumbnails/7.jpg)
Configure the graphic device (cont.)
• Filename and page setup (for PS only):
device, filename=file_name, $ /portrait (or /landscape), $ /inches, xsize=xsiz, xoffset=xoff, ysize=ysiz,
yoffset=yoff
• Select display mode (for PS only) device, bits_per_pixel=8 (or 24) IDL has two display modes PseudoColor (8-bit): each pixel can display one of 28 (256) colors TrueColor (24-bit): each pixel can display one of 224 (16,777,216) colors
![Page 8: Linear Interpolation. Linear interpolation Linear interpolation is using a straight line connecting two data points to predict any data point in between.](https://reader036.fdocuments.in/reader036/viewer/2022082419/5a4d1b3e7f8b9ab05999ffa4/html5/thumbnails/8.jpg)
Example: Output to a postscript file
set_plot,'ps’device, filename=‘a.ps’, bits_per_pixel=8, /color, /portrait, $ /inches, xsize=6.0, xoffset=1.0, ysize=9.0, yoffset=1.0
Plot, findgen(10)
device,/closeset_plot,'x'
![Page 9: Linear Interpolation. Linear interpolation Linear interpolation is using a straight line connecting two data points to predict any data point in between.](https://reader036.fdocuments.in/reader036/viewer/2022082419/5a4d1b3e7f8b9ab05999ffa4/html5/thumbnails/9.jpg)
Assignment XI• Read and plot the population history of Columbus, OH
http://www.biggestuscities.com/city/columbus-ohio and the population history of 5 other cities of your interest. Interpolate each of the time series into yearly data.
• Read and plot the maximum temperature data for Boulder, Colorado: http://www.esrl.noaa.gov/psd/boulder/Boulder.mm.maxt.html The data has some missing values. Use linear interpolation to fill the missing values.
• Output some of your previous plots to postscript files