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]
3 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:
wel3 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
Mirrors on cars exist to____.
TEA [102]

Answer:

c is ur answer

Explanation:

7 0
3 years ago
Read 2 more answers
Which type of software is created on user dimension​
Ratling [72]

Answer:

Application and system software is created on user dimension.

6 0
2 years ago
Create a list of consent rules to live by​
Agata [3.3K]
Intercourse
Kiss
Going into someone’s house
4 0
2 years ago
Calvin is creating a 3D shell of a turtle. He is creating a sculpted, intricate design for the pattern he wants on the shell, bu
PSYCHO15rus [73]
A is right I did this
7 0
1 year ago
Ebba has received a new initiative for her security team to perform an in-house penetration test. What is the first step that eb
myrzilka [38]

The first step that Ebba should take is: Information gathering and Reconnaissance.

<h3>What is an In-house Penetration Test?</h3>

An in-house Penetration test is a form of offensive test that is aimed at finding the lapses that a system has and initiating attacks to know the best way to prevent them.

Before launching such a test it is advised to plan and gather information about the possible lapses.

This will help the pen tester to know what attacks to launch and the right measures to resolve them. So, the first step that Ebba should take is Information gathering and Reconnaissance.

Learn more about In-house Penetration test here:

brainly.com/question/19085749

3 0
1 year ago
Other questions:
  • Why are many otherwise safety-conscious people victims of Internet crime?
    13·1 answer
  • Which member of the restaurant and food/beverage service career is mostly likely to plan menus and direct worker
    6·2 answers
  • How can rows be added to a table? Check all that apply
    13·2 answers
  • In order to plan George’s birthday, his father gave him a list of people who attended his birthday for the last five years. What
    8·1 answer
  • Which option is the strongest password?
    7·2 answers
  • Recursion is a natural use for a _____ (stack or queue)
    13·1 answer
  • Which party controlled the White House and politics in the late 1800s, except for Grover
    6·2 answers
  • Zoom meeting ID:987 6858 5587 Password:196133
    10·2 answers
  • Compare the two items in a summary of qualifications taken from a resumé. Which is better?
    9·1 answer
  • Hellpppppppppppppppp
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!