1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
HACTEHA [7]
4 years ago
13

Create a function that will perform linear interpolation from a set of measured data stored in a list or array. The function sho

uld take as input a list of values at which samples were taken, and then another list giving the measurements (you can assume each measurement is a single value) at
Computers and Technology
1 answer:
wel4 years ago
8 0

Answer:

This question is incomplete, here is the complete question:

Python

a) You should create a function that will perform linear interpolation from a set of measured data. The function should take as input a list of values at which samples were taken, and then another list giving the measurements (you can assume each measurement is a single value) at those values. It should also take in a query value, and should give the best estimate it can of the value at that query. Be sure to handle values that are outside of the range, by extrapolating. You should write a program that allows you to test your function by reading the lists from a file where each line of the file is a pair of numbers separated by spaces: the value where the sample was taken, and the measurement at that value. Your program should ask the user for the name of the file and for a query value. Important: The two lists will correspond to each other: i.e. for the i-th value in the first list, the measurement will be the i-th element of the second list (these are called parallel lists or arrays). But, you should not assume that the input values are in increasing/decreasing order. That is, the values in the first list can be in any random ordering, not necessarily from smallest to largest or largest to smallest. You will have to account for this in your program, and there is more than one way to do so. You should discuss what options you can think of to handle the data arriving in any order like that, and decide what you think the best option for handling it is.

Explanation:

from __future__ import division

from cStringIO import StringIO

import numpy as np

from scipy.interpolate import RectBivariateSpline

np.set_printoptions( 1, threshold=100, edgeitems=10, suppress=True )

   # a file inline, for testing --

myfile = StringIO( """

# T P1 P2 P3 P4

0,   80,100,150,200

75, 400,405,415,430

100, 450,456,467,483

150, 500,507,519,536

200, 550,558,571,589

""" )

   # file -> numpy array --

   # (all rows must have the same number of columns)

TPU = np.loadtxt( myfile, delimiter="," )

P = TPU[0,1:] # top row

T = TPU[ 1:,0] # left col

U = TPU[1:,1:] # 4 x 4, 400 .. 589

print "T:", T

print "P:", P

print "U:", U

interpolator = RectBivariateSpline( T, P, U, kx=1, ky=1 ) # 1 bilinear, 3 spline

   # try some t, p --

for t, p in (

   (75, 80),

   (75, 200),

   (87.5, 90),

   (200, 80),

   (200, 90),

   ):

   u = interpolator( t, p )

   print "t %5.1f p %5.1f -> u %5.1f" % (t, p, u)

You might be interested in
Why are there problems with patching electronics such as heart rate monitors and MRI machines that run embedded Windows OSs?
timofeeve [1]

Answer:

The various problems with patching electronics such as heart rate monitors and MRI machines that run embedded Windows OSs is that they have a certification which is usually at a specific revision level.

Another issue is that probably the maker or the manufacturer didn’t provide the patch method which would have been used to fix such electronics.

8 0
3 years ago
Rose has a list of two columns of information separated by tabs. She wants to input this information into a table. What is the f
andreev551 [17]
I gotchu my bro!!
it would be D. " clicking Convert Text to Table"
7 0
3 years ago
Read 2 more answers
Can you guess why some of the nodes would still have statically assigned ip addresses?
LiRa [457]

<span>The manual assignment of an IP address to a system is called static addressing. Since the assignment of IP has been entered manually using ARP utility, the network administrators probably forgot to remove the manually configured nodes with IP addresses.  </span>

7 0
3 years ago
Why does my playstation keep disconnecting from wifi?.
REY [17]

Answer:

because there might be a internet

problem

Explanation:

5 0
2 years ago
Anyone know how to translate this 1100111111110100000110 pls n ty!4!:$;
marysya [2.9K]

Answer:

1100111111110100000110 = �

Binary -> UTF-16

3,407,110 in decimal form

Additionally, it also translates to the color green in hexadecimal.

Not really sure what you are trying to translate this in to though.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Each of the major DBMS products changes quite rapidly, and keeping DBMS software up-to-date can be a difficult task. As a DBA, w
    14·1 answer
  • Stella is a bank executive. She is preparing a spreadsheet on the loan repayment schedules of customers. Which function can she
    12·1 answer
  • Char[][] array1 = new char[15][10];
    5·1 answer
  • b) Derive the logic expressions for the incrementor and 7-sgement decoder. Since software can perform gate-level optimization, y
    7·1 answer
  • Help, I'm a beginner in coding! I have to write a quiz. You don't have to get all fancy and stuff, since I'm a beginner lol. I w
    12·1 answer
  • Which statement is true about hacking?
    11·2 answers
  • Write a c++ program that generates three random numbers. The first number should be between 0-30, the second number should be be
    7·1 answer
  • In binary, the second digit from the right is multiplied by the first power of two, and the _____ digit from the right is multip
    10·2 answers
  • All languages require the code which is simply a word that means _____.
    9·1 answer
  • Ali has created a small program in Python, but he wants to store his data in a multi-dimensional array. He would like to use adv
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!