answer.
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
faust18 [17]
2 years ago
3

Write Python code that produces an array called epsilon of length 10000 for which plt.acorr(epsilon), the plot of correlation be

tween values, produces a plot with a correlation above 0.25 at lags 0,1 and 2, and has a correlation below 0.05 for lags strictly larger than 2. Hand in your code and your plot.
Computers and Technology
1 answer:
Alekssandra [29.7K]2 years ago
4 0

Answer:

Check the explanation

Explanation:

acorr() is function in matplotlib module in python. acorr() in full meaning is Auto-Correlation function(). and it it generally used to find  out   Auto-Correlation of array of x element.

matplotlib.pyplot.acorr()

# Implementation acorr()  

import matplotlib.pyplot as plt

import numpy as np

epsilon= np.random.randn(1000)

plt.title("Autocorrelation")

plt.acorr(epsilon, usevlines = True,  

    normed = True, maxlags =2,  

    lw = 3)

plt.grid(True)

plt.show()

also i have created the exmaple for both Auto as well as cross correlation as below

import matplotlib.pyplot as plt

import numpy as np

np.random.seed(10**3)

x, y = np.random.randn(2, 1000)

fig, [ax1, ax2] = plt.subplots(2, 1, sharex=True)

ax2.acorr(x, usevlines=True, normed=True, maxlags=50, lw=2)

ax2.grid(True)

ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True, lw=2)

ax1.grid(True)

plt.show()

You might be interested in
Which set of variables will make code easier to understand?
Alecsey [184]

Answer:

sum, price, count

Explanation:

Programmers should use significant names for the variables.

Not only it makes it easier for them to remember what kind of information is stored in each variable, but it also makes life simpler for anyone who would read the code later.

Names like sum, price and count are significant names ( assuming they actually hold this kind of data), and will make the re-reading of the program code much easier.

8 0
2 years ago
Calvin is an aspiring graphic designer. He wants to achieve Adobe Certified Expert certification in software that will be helpfu
bazaltina [42]

Answer:

a

Explanation:

9 0
2 years ago
2) Complete the get_num_of_characters() function, which returns the number of characters in the user's string. We encourage you
Lilit [14]

Explanation:

Number of characters: 46

String with no whitespace: Theonlythingwehavetofearisfearitself.

########################################################

def get_num_of_characters(inputStr):

   count = 0

   for i in range(0,len(inputStr)):

       count = count + 1

   #count = len(inputStr)

   return count

def output_without_whitespace(inputStr):

   #statement = statement.strip()

   statement2 = ' '

   for i in range(0,len(inputStr)):

        if(inputStr[i] == ' '):

           statement2 = statement2

       else:

           statement2 = statement2 + inputStr[i]

       

   inputStr = inputStr.replace(" ", "")

   return statement2

inputStr = input('Enter a sentence or phrase: ')

print()

print('You entered:', inputStr)

num = get_num_of_characters(inputStr)

print()

print('Number of characters:', num)

print('String with no whitespace:',output_without_whitespace(inputStr))

#if __name__ == '__main__':

   # Think I'm supposed to use this if statement

########################################################

'''ERROR MESSAGE WHEN RUNNING TEST

Unit test

0/1

Tests that get_num_of_characters() returns 46 for "The only thing we have to fear is fear itself."

Your output

Enter a sentence or phrase: Traceback (most recent call last):

 File "zyLabsUnitTestRunner.py", line 4, in <module>

   from zyLabsUnitTest import test_passed

 File "/home/runner/local/unit_test_student_code/zyLabsUnitTest.py", line 1, in <module>

   from main import get_num_of_characters

 File "/home/runner/local/unit_test_student_code/main.py", line 19, in <module>

   inputStr = input('Enter a sentence or phrase: ')

EOFError: EOF when reading a line'''

6 0
2 years ago
Write a function string middle(string str) that returns a string containing the middle character in str if the length of str is
Katen [24]

Answer:

function getMiddle(s) {

return s.length % 2 ? s.substr(s.length / 2, 1) : s.substr((s.length / 2) - 1, 2);

}

// I/O stuff

document.getElementById("submit").addEventListener("click", function() {

input = document.getElementById("input").value;

document.getElementById("output").innerHTML = getMiddle(input);

});

Explanation:

// >>> is an unsigned right shift bitwise operator. It's equivalent to division by 2, with truncation, as long as the length of the string does not exceed the size of an integer in Javascript.

// About the ~ operator, let's rather start with the expression n & 1. This will tell you whether an integer n is odd (it's similar to a logical and, but comparing all of the bits of two numbers). The expression returns 1 if an integer is odd. It returns 0 if an integer is even.

// If n & 1 is even, the expression returns 0.

// If n & 1 is odd, the expression returns 1.

// ~n & 1 inverts those two results, providing 0 if the length of the string is odd, and 1 if the length of the sting is even. The ~ operator inverts all of the bits in an integer, so 0 would become -1, 1 would become -2, and so on (the leading bit is always the sign).

// Then you add one, and you get 0+1 (1) characters if the length of the string is odd, or 1+1 (2) characters if the length of the string is even.

6 0
2 years ago
To determine why a computer program started to function differently, Mel should most likely use data to
Amiraneli [1.4K]

Answer:

convince the software company of the issue

Explanation:

3 0
2 years ago
Read 2 more answers
Other questions:
  • A storyboard is essentially an outline of a web page's content and design<br> -True or False
    8·2 answers
  • What is the area of a parallelogram whose vertices are A(−1, 12) , B(13, 12) , C(2, −5) , and D(−12, −5) ? Enter your answer in
    9·2 answers
  • Danilo is planning the art to include in a business proposal his team is preparing. For which of the following items should Dani
    7·2 answers
  • Assume a program requires the execution of 50 x 106 FP instructions, 110 x 106 INT instructions, 80 x 106 L/S instructions, and
    9·1 answer
  • Team A found 342 errors during the software engineering process prior to release. Team B found 184 errors. What additional measu
    12·1 answer
  • The Company management has asked that you compare the OSSTMM and the PTES to determine which methodology to select for internal
    13·1 answer
  • The new Director of Information Technology has asked you to recommend a strategy to upgrade the servers on their network. Recomm
    9·1 answer
  • In which of the security mechanism does the file containing data of the users/user groups have inbuilt security?
    6·1 answer
  • A semaphore puts a thread to sleep:
    12·1 answer
  • A company has deployed four 48-port access layer switches to a switch block. For redundancy each access layer switch will connec
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!