Error: Creation of Function Handle is not supported by arrayFun call.
古いコメントを表示
I am trying my hand at using GPU tools for ODE computation in efforts to emulate a project that did that. I tried running a simple program through the same. My code is divided into three parts
My Main Function -
tspan = gpuArray([0,20]);
y1=gpuArray(2);
corrected = arrayfun(@wrap,tspan,y1);
[t,y] = gather(corrected);
A wrap function that calls ode45-
function [t,y] = wrap(tspan,y0)
[t,y]= ode45(@vbp1,tspan,y0);
end
vbp1
function dydt = vbp1(t,ya)
dydt = [ya(2); (1-ya(1)^2)*ya(2)-ya(1)];
end
This is the error I seem to be getting
Error using main (line 4)
Creation of function handles is not supported.
For more information see Tips.
Error in 'wrap' (line: 2)
Can anyone figure out why this error is being thrown. I'm fairly new to MATLAB, so please forgive me if the errors are rudimentary.
回答 (1 件)
Walter Roberson
2022 年 10 月 19 日
1 投票
You have more than one challenge here.
The one that is more limiting is that ode45 and the similar functions do not support GPUs.
[https://www.mathworks.com/help/matlab/referencelist.html?type=function&capability=gpuarrays>
This is not why you received the error, but it tells you that the other problem is not worth solving at this point.
カテゴリ
ヘルプ センター および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!