我有以下离散形式的函数(这意味着它们是数组):
p1_1 of dim(200x1)
p1_2 of dim(200x1)
p1_3 of dim(200x1)
p2_1 of dim(200x1)
p2_2 of dim(200x1)
p2_3 of dim(200x1)
函数p1_1, p1_2, p1_3
已被评估为点和点处的x1 = 0:(10/199):10
函数。p2_1, p2_2, p2_3
x2 = 0:(10/199):10
由于我有函数值和函数被评估的点,我可以执行以下操作:
fun1_of_p1 = @(xq1) interp1(x1,p1_1,xq1);
fun1_of_p2 = @(xq1) interp1(x1,p1_2,xq1);
fun1_of_p3 = @(xq1) interp1(x1,p1_3,xq1);
和
fun2_of_p1 = @(xq2) interp1(x2,p2_1,xq2);
fun2_of_p2 = @(xq2) interp1(x2,p2_2,xq2);
fun2_of_p3 = @(xq2) interp1(x2,p2_3,xq2);
然后我需要能够执行以下操作:
new_fun1 = @(xq1,xq2) fun1_of_p1.*fun2_of_p1;
new_fun2 = @(xq1,xq2) fun1_of_p1.*fun2_of_p2;
new_fun3 = @(xq1,xq2) fun1_of_p1.*fun2_of_p3;
new_fun4 = @(xq1,xq2) fun1_of_p2.*fun2_of_p1;
new_fun5 = @(xq1,xq2) fun1_of_p2.*fun2_of_p2;
new_fun6 = @(xq1,xq2) fun1_of_p2.*fun2_of_p3;
new_fun7 = @(xq1,xq2) fun1_of_p3.*fun2_of_p1;
new_fun8 = @(xq1,xq2) fun1_of_p3.*fun2_of_p2;
new_fun9 = @(xq1,xq2) fun1_of_p3.*fun2_of_p3;
最后
last_fun = @(xq1,xq2) gamma1*new_fun1 + gamma2*new_fun2 +...
gamma3*new_fun3 + gamma4*new_fun4 + gamma5*new_fun4 +...
gamma6*new_fun6 + gamma7*new_fun7 + gamma8*new_fun8 +...
gamma9*new_fun9;
-valuesgamma
只是常量(实数值常量)。在我定义之后last_fun
,我需要申请ode45
它但我不知道该怎么做,我尝试了:
([T,V] = ode45(@(xq1,xq2)last_fun(xq1,xq2),tspan,x0)
但它不起作用。实际上我不知道我所做的一切是否正确,因此非常感谢一些反馈!