Error When Using ODE45 to solve symbolic ODE Equation : Too many input arguments.

Hi All,
I'm trying to solve the equation below. But when I tried to solve the equtioon I keep reciveing the error "Too Many Input Arguments". I'm not sure what I'm doing wrong.
syms p(t)
s = 1;
N_s = 3e15;
V = 16.7;
S = 4.6;
tao_p = 3.6;
tao_0 = 10e-13;
v=4.82e20;
R=8.31;
T=295;
Ed = 25;
a = ((s*v*tao_0)/(N_s))*exp((Ed)/(R*T));
ode = diff(p)*(1/p) == -((1)/((tao_p)+((tao_p*N_s*a)/(V*((1+a*p)^2)))));
cond = p(0) == 3;
pSol(t) = dsolve(ode,cond)
pp = odeToVectorField(ode);
odsefcn = matlabFunction(pp)
interval = [0 2000];
yInit = [3];
ySol = ode45(odsefcn,interval,yInit);
tValues = linspace(0,20,100);
yValues = deval(ySol,tValues,1);
plot(tValues,yValues)
Thanks in advance...

 Accepted Answer

s = 1;
N_s = 3e15;
V = 16.7;
S = 4.6;
tao_p = 3.6;
tao_0 = 10e-13;
v=4.82e20;
R=8.31;
T=295;
Ed = 25;
a = ((s*v*tao_0)/(N_s))*exp((Ed)/(R*T));
interval = [0 200000000];
yInit = 3;
odsefcn = @(t,y)y(1)*(-((1)/((tao_p)+((tao_p*N_s*a)/(V*((1+a*y(1))^2))))))
odsefcn = function_handle with value:
@(t,y)y(1)*(-((1)/((tao_p)+((tao_p*N_s*a)/(V*((1+a*y(1))^2))))))
[tSol,ySol] = ode45(odsefcn,interval,yInit);
plot(tSol,ySol)

3 Comments

Thnak you so much for your kind support. I have one minor issue. When I try to set the axis limits
% plot(tSol,ySol)
[tSol,ySol] = ode45(odsefcn,interval,yInit);
loglog(tSol,ySol)
ylim([1e-2 1e-11])
xlim([10 1e6])
I get the following error:
Error using ylim (line 31)
Limits must be a 2-element vector of increasing numeric values.
Error in TEST_Outgassing_ode_Matlab_fixed (line 22)
ylim([1e-2 1e-11])
How can I set my time scale ? the time in the actual experiments is upto 150 hours.
Thanks in advance.
Limits must be a 2-element vector of increasing numeric values.
and
1e-2 > 1e-11
Do you see the problem ?
Thats great! I Appreciate your support!

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products

Release

R2021a

Asked:

N/A
on 7 Jan 2023

Edited:

N/A
on 7 Feb 2023

Community Treasure Hunt

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

Start Hunting!