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에서 Call Python from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by