필터 지우기
필터 지우기

How to solve ODE match problem ?

조회 수: 1 (최근 30일)
Victor Kang
Victor Kang 2017년 9월 12일
댓글: Victor Kang 2017년 9월 13일
my code is
global r;
y0=zeros(1,r^3);
t=[0,10];
[x,y]=ode23('diffusion',t,y0);
And the diffusion function is(I've simplified the code)
function [ c ] = diffusion(t,f)
global r;
for x=0:r-1
for y=0:r-1
for z=0:r-1
df(x*r*r+y*r+z+1)=f(x*r*r+y*r+z+1)*d;
end
end
end
c=df(:);
end
_Then the problem is
"错误使用 odearguments (line 90) Number of rows in exponent vector Alpha and volatility matrix Sigma must match.
出错 ode23 (line 114) odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
出错 dif (line 10) [x,y]=ode23('diffusion',t,y0);"
How to solve this problem? Thanks a lot. If you want, you can download all my code.

채택된 답변

Walter Roberson
Walter Roberson 2017년 9월 12일
The Finance diffusion class constructor https://www.mathworks.com/help/finance/diffusion_constructor.html is taking priority over your local diffusion function.
Have a look at https://www.mathworks.com/help/matlab/matlab_prog/function-precedence-order.html and see that @ class constructors are step 7 but functions in the current folder are step 9.
The easiest fix is to rename your diffusion function to something else.
  댓글 수: 1
Victor Kang
Victor Kang 2017년 9월 13일
Thanks! It is clearly that I've made a foolish mistake that my function's name is same as the diffusion tools. Without your help, I may wast more hours in it. Thanks a lot.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 数学에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!