I recently got the same problem as this post linked I tried the method is done and it dint work. the following is my code can anyone tell me how this error is occurring and how to fix it?
from scipy import signal
import numpy as np
import random
import matplotlib.pyplot as plt
fs=20000 #20k hertz
#phase accumlator
#note change the number of bits for this lab
number_of_bits=8
zero=0
clk=np.random.randint(2,size=100)
#make a list 32 bits
#inltliize m
step =1
stepsize=2**number_of_bits
#lut
def lut():
loopuptable = []
time =np.arange(0,number_of_bits,0.1)
#sinewave
amplitude_of_sine=np.sin(time)
#cossinewave
amplitude_of_cosine=np.cos(time)
#square num 0
amplitude_of_square=signal.square(2 * np.pi * 5 * time)
#you can add more varitions of these wavefroms but for this it best to leave
#these as example in the future might sperate it into a different program
loopuptable.append(amplitude_of_cosine)
loopuptable.append(amplitude_of_sine)
loopuptable.append(amplitude_of_square)
#ploting whats
while(step < stepsize):
M_postion = step//stepsize-1
step += 1
#DAC