Answer to Question #205278 in Python for Reoma Alurd

Question #205278

import numpy as np

import scipy.linalg as la

import matplotlib.pyplot as plt

5. Use the np.linspace function to create a row vector called meshPoints

containing exactly 500 values with values evenly spaced between -1 and 1.

 

6. What expression will yield the value of the 53th element of meshPoints?

What is this value?

 

7. Produce a plot of a sinusoid on the interval [−1, 1] using the command

 

plt.plot(meshPoints,np.sin(2*pi*meshPoints))


1
Expert's answer
2021-06-10T05:17:24-0400
import math
import numpy as np
import scipy.linalg as la
import matplotlib.pyplot as plot

meshPoints = np.linspace(-1,1,500)

print('Answer to the 5 question: \n', meshPoints)

print('Answer to the 6 question: \n', meshPoints[52])

print('Answer to the 7 question: \n')

plot.plot(meshPoints,np.sin(2*math.pi*meshPoints))

# Give a title for the sine wave plot
plot.title('Sine wave')

# Give x axis label for the sine wave plot
plot.xlabel('Time')

# Give y axis label for the sine wave plot
plot.ylabel('Amplitude = sin(time)')
plot.grid(True, which='both')
plot.axhline(y=0, color='k')
plot.show()

# Display the sine wave
plot.show()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS