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
The scope of a variable declared outside of any function is:
Marta_Voda [28]

Answer:

a) Global

Explanation:

The scope of a variable declared outside of any function is Global.

Let us consider an example:

int g;

int  add(int a,int b){

   return a+b;

}

int  subtract(int a,int b){

   return a-b;

}

Here the variable g is defined outside any function and is accessible anywhere within the program. This is a global variable.

Variables defined within each function - a,b on the other hand have a local scope are are visible only within their respective function bodies.

5 0
3 years ago
Shop anywhere. Snap every receipt. Earn FREE gift cards! Sign up for Fetch with my code "DUEUY" and get 2,000 points when you sn
katovenus [111]

Answer:

mk

Explanation:

i think its DUEUY

4 0
3 years ago
10. Question<br> What are the drawbacks of purchasing something online? Check all that apply.
max2010maxim [7]

Explanation:

1) the quality of purchased good may be low

2) there might me fraud and cheaters

3) it might be risky

4) we may not get our orders on time

7 0
2 years ago
WILL GIVE BRAINLIEST TO HELPFUL ANSWERS!
sashaice [31]

Algorithm is part of computer science. You an learn it on Khan academy. (you probably werent looking for this but no one was answering)

7 0
3 years ago
You work as a Network Administrator for wwwpany Inc. You have suspected a bad driver or perhaps malware. Which of the following
vichka [17]

Answer:

Explanation:

There is a solution called ETA (Encrypted Traffic Analytics) this is a security advanced network that helps us to identify malware between the encrypted data, but with this tool is no necessary to break any protection and privacy chain.

This technology use machine learning to read all the traffic without deciphering it, in this way we can detect a difference between reliable and malicious traffic.

En windows we can use Microsoft Security Essentials like antivirus and detect virus, we can use Process Explorer, analyze the traffic, we can use Microsoft Network Monitor.

8 0
3 years ago
Other questions:
  • Which is a benefit of peer-to-peer networking?
    10·1 answer
  • Suppose company A wants to develop a program that duplicates the functionality of a programm by company B. Describe how company
    8·1 answer
  • How many categories of bitmap images are there?
    8·1 answer
  • Assume that ip has been declared to be a pointer to int and that enrollment has been declared to be an array of 20 elements . As
    13·1 answer
  • Which of the selections below represents a recursive query?
    12·1 answer
  • What is wrong with this code and correct it.
    12·1 answer
  • hey guys just dropped some hot beats so go and follow me my user is the beats and comment if you would do that that would be gra
    11·1 answer
  • Please help me in this question​
    7·2 answers
  • Find examples of conic sections in art and architecture. Visit Web sites to find pictures of artwork or buildings that illustrat
    14·1 answer
  • The ________ approach to motivation suggests a connection between internal physical states and outward behavior. achievement dri
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!