Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Not enough input arguments for my ode15s solver

1 Ansicht (letzte 30 Tage)
HSIN-Yi CHEN
HSIN-Yi CHEN am 19 Okt. 2022
Geschlossen: Stephen23 am 19 Okt. 2022
I got my code following
clear
load("BurgersMatrices_2022.mat");
T = 3; nt = 600; tspan = linspace(0,T,nt);
options = odeset('Mass',E);
x0 = [0; x0b ; 0];
[tout,xout] = ode45(@(t,x) prime,tspan,x0,options);
function out = prime(t,x)
load("BurgersMatrices_2022.mat");
J = nonzeros(A); A1 =J(1) ; A2 = J(2);
J = nonzeros(H); H2 = J(2); H3 = J(1);
for j = 2:1025
one(j) = A1*x(j) + A2*(x(j-1)+x(j+1));
two(j) = H2*(x(j+1))^2 + H3*(x(j-1))^2;
out(j) = one(j)-0.5*two(j);
end
out(1026) = 0;
out = out';
end
where my x0b is a 1024*1 vector and x0 vector is 1026*1. E is a mass matrix for E (dx/dt) = f(x). I got the error "Not enough input arguments." saying
Error in HW1_P1>prime (line 16)
one(j) = A1*x(j) + A2*(x(j-1)+x(j+1));
Error in HW1_P1>@(t,x)prime (line 9)
[tout,xout] = ode45(@(t,x) prime,tspan,x0,options);
Error in odearguments (line 92)
f0 = ode(t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 107)
odearguments(odeIsFuncHandle,odeTreatAsMFile, solver_name, ode, tspan, y0, options, varargin);
Error in HW1_P1 (line 9)
[tout,xout] = ode45(@(t,x) prime,tspan,x0,options);
i'm not sure what's wrong with it, could anyone help me with this? Thank you.

Antworten (0)

Diese Frage ist geschlossen.

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by