0
我在离散形式以下功能(这意味着它们是数组):乘以2个功能句柄并施加ODE45到结果
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;
gamma
-值只是常数(实数值常量)。我已经定义last_fun
后,我需要申请ode45
它,但我不知道该怎么做,我想:
([T,V] = ode45(@(xq1,xq2)last_fun(xq1,xq2),tspan,x0)
但它不工作。其实我不知道我所做的一切是否正确,所以一些反馈将非常感谢!
谢谢你的答案!我会立即纠正这些功能!顺便说一句,令人惊讶的是你解释一个函数的句柄是什么!我现在可以申请'ode45'吗?如何才能制定出应用'ode45'的正确方法? – 2014-10-16 11:55:24
只要'tspan'和'x0'具有相同的大小和向量,正确的方法是'[T,V] = ode45(last_fun,tspan,x0)'。 – 2014-10-16 12:00:57
再次感谢!我会检查你的建议! :) – 2014-10-16 12:02:19