"Error using symengine>@()0.0 Too many input arguments."
4 次查看(过去 30 天)
显示 更早的评论
I continue to receive the following error:
Error using symengine>@()0.0
Too many input arguments.
Error in bdipuniodefun (line 17)
bdip = [s(4); s(5); s(6); (q/m_e)*(Ex(s(1),s(2),s(3)) + s(5)*Bz(s(1),s(2),s(3)) - s(6)*By(s(1),s(2),s(3)));
(q/m_e)*(Ey(s(1),s(2),s(3)) + s(6)*Bx(s(1),s(2),s(3)) - s(4)*Bz(s(1),s(2),s(3))); (q/m_e)*(Ez(s(1),s(2),s(3)) +
s(4)*By(s(1),s(2),s(3)) - s(5)*Bx(s(1),s(2),s(3)))];
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode15s (line 150)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in collisions (line 195)
[T,S] = ode15s(@bdipuniodefun, tspan, icv);
However, the exact same ode solver and ode's are used in another piece of code I am running and I do not get the same error. I went through the entire code, line by line to try to figure out what is going on for hours on end and cannot figure out why this is happening. Any constructive suggestions here would be appreciated.
%User inputs
%TSTEP MUST BE ABLE TO GO INTO TFIN AN ODD AMOUNT OF TIMES (Because simulation includes tstep @ 0 so it ends up being even)
tstep = 0.25E-7; %Defining time step
tfin = 3E-7; %Defining final time
ienergy = 1E-19;
%Initial conditions to solve for pitch angle and lambda value
lambdacheck = 60; %In degrees
options = odeset('RelTol',tstep,'AbsTol',tstep);
sine2alpha = (cosd(lambdacheck)^6)/sqrt(1+3*sind(lambdacheck)^2);
m_e = 9.11E-31;
v0mag = sqrt(2*ienergy/m_e);
vx = 0;
vy = sqrt(sine2alpha)*v0mag;
vz = sqrt(1 - sine2alpha)*v0mag;
x = 0.03;
y = 0;
z = 0;
icposition = [x,y,z];
icvelocity = [vx,vy,vz];
%datasetnum = 'data_set7.mat'; %Name file where initial electron positions, initial electron velocities, collision position, mfp and energy matrix will be saved
tic %Begin timer
%Create zeros matrices to populate later
intspan = [0:tstep:tfin]; %Total time span
intspancol = intspan(:); %inverts matrix's rows and columns
[introw,intcol] = size(intspancol);
%Generate matrix that will be populated by positions and velocities (Each matrix within structure "Wposandvel" should be of size 2*introw-1 by 6)
Wposandvel = zeros(2*introw-1,6);
%This section is purely for generating matrices the program will populate later
tindex = [0:1:introw-2];
tindexcol = tindex(:); %inverts matrix's rows and columns
[tinrow,tincol] = size(tindex);
for t = 0:1:introw-2 %complete time interval and time step
[trow,tcol] = size(t);
r = sqrt(x.^2 + y.^2 + z.^2);
vmag = sqrt(vx.^2 + vy.^2 + vz.^2);
%Coupled differential equation solver for trajectory within current time step
icv = [x; y; z; vx; vy; vz]; %Initial conditions
tspan = [intspan(t+1) ((intspan(t+2)-intspan(t+1))/2)+intspan(t+1) intspan(t+2)]; %Time span
tic
%Trajectory solver
[T,S] = ode15s(@bdipuniodefunetest, tspan, icv);
[rownum,colnum] = size(S);
Wposandvel((1+2*t):(3+2*t),(1:6)) = S;
toc
%Redfine the velocity and position components to reference on next if-loop run
x = Wposandvel((3+2*t),1);
y = Wposandvel((3+2*t),2);
z = Wposandvel((3+2*t),3);
vx = Wposandvel((3+2*t),4);
vy = Wposandvel((3+2*t),5);
vz = Wposandvel((3+2*t),6);
end
delete(waitb);
bdipuniodenetest Function:
function bdip = bdipuniodefunetest(t,s)
%Using SI units
q_e = -1.60217662E-19;
m_e = 9.11E-31;
persistent Bx By Bz Ex Ey Ez
if isempty(Bx)
[Bx, By, Bz] = B_test();
end
if isempty(Ex)
[Ex, Ey, Ez] = E_test0();
end
bdip = [s(4); s(5); s(6); (q_e/m_e)*(Ex(s(1),s(2),s(3)) + s(5)*Bz(s(1),s(2),s(3)) - s(6)*By(s(1),s(2),s(3))); (q_e/m_e)*(Ey(s(1),s(2),s(3)) + s(6)*Bx(s(1),s(2),s(3)) - s(4)*Bz(s(1),s(2),s(3))); (q_e/m_e)*(Ez(s(1),s(2),s(3)) + s(4)*By(s(1),s(2),s(3)) - s(5)*Bx(s(1),s(2),s(3)))];
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!