numpy中的错误:ufunc'multiply'不包含签名匹配类型的循环

问题描述

Error in Console

在控制台中出现错误

回溯(最近通话最近): 文件“ C:\ Users \ user \ PycharmProjects \ NAS2 \ main.py”,第29行,在 SecondarySIG [2] =(KVar * X-AngularFrequency * T + Phase) numpy.core._exceptions.UFuncTypeError:ufunc'multiply'不包含签名匹配类型为(dtype(' dtype('

import numpy as np
import matplotlib.pyplot as plt

# required library for plots and graphs
np.seterr(divide='ignore')
Frequency = np.zeros(2)
Amplitude = np.zeros(2)
Phase = np.zeros(4)
SOL = 3 * 10^8
AngularFrequency = 2 * 3.14 * Frequency
WL = SOL / Frequency
KVar = 6.28 / WL
for i in range(5):
print(f"Signal input values{i + 1}")
Phase = input("How many phases is this signal going through?")
Frequency = input("What is your desired frequency?")
Amplitude = input("What is your desired amplitude?")
X = input("Please enter the full input distance of this signal?")
T = input("Please enter the amount of time this signal will be running for?")
# The block above concerns the user for his/her inputs for the graph along
# with setting the needed formulae/values for the signal graph

SecondarySIG[2] = (KVar * X - AngularFrequency * T + Phase)
PrimarySIG[1] = (KVar * X - AngularFrequency * T + Phase)
CUL = PrimarySIG[3] + SecondarySIG
# Essential Formulae for the Signals

fig,axes = plt.subplots(5,2)
axes[2].plot(T,SecondarySIG)
axes[1].plot(T,PrimarySIG)
axes[3].plot(T,CUL)
# Declares plotable canvas for the graphs

print("Graphs of Signal 1,Signal 2,and their combination")
SecondarySIG = np.sin(KVar * X - AngularFrequency * T + Phase)
PrimarySIG = np.sin(KVar * X - AngularFrequency * T + Phase)
CUL = PrimarySIG + SecondarySIG
# Function responsible for drawing the actual graph on the canvas`enter code here`

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)