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

1 回表示 (過去 30 日間)
Sneh
Sneh 2023 年 2 月 17 日
コメント済み: Alan Stevens 2023 年 2 月 17 日
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 Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by