I keep getting errors when I try to integrate kinematic and dynamic differential equation

1 次查看(过去 30 天)
import numpy as np
from scipy.integrate import quad
def kde_integral(x):
return (1/np.sqrt(2*np.pi))*np.exp(-x*2/2)
def dde_integral(x):
return 2*x*(1/np.sqrt(2*np.pi))*np.exp(-x*2/2)
integ_kde = quad(kde_integral, -np.inf, np.inf)[0]
integ_dde = quad(dde_integral, -np.inf, np.inf)[0]
% Plotting the K-Ko graph
def plot_kk_graph():
x = np.linspace(-5, 5, 1000)
kde_y = kde_integral(x)
dde_y = dde_integral(x)
k = np.trapz(kde_y, x=x)
ko = np.trapz(dde_y, x=x)
plt.plot(k, ko, color='b')
plt.title("K-Ko Graph")
plt.xlabel("K")
plt.ylabel("Ko")
plt.show()
plot_kk_graph()
I get the following errors:
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
How do i fix it?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by