Borrar filtros
Borrar filtros

Why am i getting the error 'The first input to exist must be a string scalar or character vector' while solving 4 ode using ode45 solver ??

10 visualizaciones (últimos 30 días)
I have four differential equation. In these four equation u, s, p, r is the function of t. I solve these equation using ode45 solver but i am getting the error massage. Code is: y0 is the initial condition and its [u0,s0,p0,r0]. Please give me some solution for this error. Thank you for help
clc
clear
close all
b = deg2rad(45);
tspan = [0 pi];
y0 = [0.10 3.14e-06 1.4706 145.60];
syms u(t) s(t) p(t) r(t) t
eq01 = u*diff(s,t) + s*diff(u,t) == (sin(b)^3)/(4*((cos(b)*cos(t)).^2));
eq02 = (u.^2)*diff(s,t)+(2*s*u)*diff(u,t) == cos(b)*(sin(b)^3)/(4*((cos(b)*cos(t)).^2));
eq03 = (u.^2*s)*(1+diff(p,t))*sin(p) == (2*r/52) - (sin(p).^2)*(sin(b)^3)/(4*((cos(b)*cos(t)).^2));
eq04 = diff(r,t) == r*cot(p);
eqs = [eq01, eq02, eq03, eq04];
m = ode45(eqs,tspan,y0);

Respuestas (2)

Torsten
Torsten el 17 de Ag. de 2023
Editada: Torsten el 17 de Ag. de 2023
ode45 is a numerical integrator. It doesn't accept symbolic inputs.
b = deg2rad(45);
tspan = [0 pi];
y0 = [0.10 3.14e-06 1.4706 145.60];
[T,Y] = ode15s(@(t,y)fun(t,y,b),tspan,y0);
plot(T,Y(:,1))
function dydt = fun(t,y,b)
s = y(1);
u = y(2);
p = y(3);
r = y(4);
M = [u s 0 0;u^2 2*s*u 0 0;0 0 u^2*s*sin(p) 0;0 0 0 1];
rhs = [(sin(b)^3)/(4*((cos(b)*cos(t)).^2));cos(b)*(sin(b)^3)/(4*((cos(b)*cos(t)).^2));(2*r/52) - (sin(p).^2)*(sin(b)^3)/(4*((cos(b)*cos(t)).^2))-u^2*s*sin(p);r*cot(p)];
dydt = M\rhs;
end
  2 comentarios
Steven Lord
Steven Lord el 17 de Ag. de 2023
b = deg2rad(45);
tspan = [0 pi];
y0 = [0.10 3.14e-06 1.4706 145.60];
[T,Y] = ode15s(@(t,y)fun(t,y,b),tspan,y0);
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.202421e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.162016e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.755300e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.296786e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.761677e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.495964e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.495964e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.495964e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.491232e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.495964e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.210173e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.784123e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.082411e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.193464e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.955085e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.201540e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.227176e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.421044e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.421044e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.421045e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.420571e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.421044e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.227176e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.933827e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.132025e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.828692e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.167597e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.943339e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.539442e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.621429e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.097963e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.957193e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.229461e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.229461e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.229461e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.228988e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.229461e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.957193e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.039235e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.010955e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.180171e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.426638e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.202677e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.678236e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.449070e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.060970e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.821548e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.798285e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.809938e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.664316e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.215047e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.847792e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.847792e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.847792e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.847319e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.847792e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.664316e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.672919e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.478640e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.487346e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.222938e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.915523e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.462267e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.643241e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.460253e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.270112e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.169306e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.710421e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.279308e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.279308e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.279308e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.278835e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.279308e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.169306e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.008532e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.750343e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.802833e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.124655e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.293371e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.369479e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.970285e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.842619e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.737931e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.971506e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.130220e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.456633e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.456633e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.456633e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.456160e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.456633e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.971506e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.115880e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.718084e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.090745e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.608101e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.354133e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.202073e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.140339e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.820256e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.371861e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.811879e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.249059e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.249059e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.249059e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.249012e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.249059e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.811879e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.882206e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.692223e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.477575e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.935746e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.501585e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.112414e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.079811e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.083250e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.637842e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.234746e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.031661e-16.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.888759e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.888759e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.888759e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.888286e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.888759e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.234746e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.087628e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.582106e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.860422e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.347500e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.921619e-20.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.126381e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.893664e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.873106e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.246835e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.124649e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.048437e-17.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.308396e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.308396e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.308396e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.307922e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.308396e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.124649e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.211133e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.458070e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.682707e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.215440e-20.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.275961e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.994137e-20.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.990218e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.125701e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.265351e-20.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.786581e-20.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.044201e-20.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.992934e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.091072e-18.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.398607e-20.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.398607e-20.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.398608e-20.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.398134e-20.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.398607e-20.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.992934e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.461742e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.175783e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.887701e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.030637e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.409217e-19.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.390196e-20.
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.883651e-20.
Warning: Failure at t=1.986064e-13. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (4.038968e-28) at time t.
plot(T,Y(:,1))
% Check reciprocal condition number of M at initial conditions
y = [0.10 3.14e-06 1.4706 145.60];
s = y(1);
u = y(2);
p = y(3);
r = y(4);
format longg
M = [u s 0 0;u^2 2*s*u 0 0;0 0 u^2*s*sin(p) 0;0 0 0 1]
M = 4×4
3.14e-06 0.1 0 0 9.8596e-12 6.28e-07 0 0 0 0 9.81014963099981e-13 0 0 0 0 1
rcond(M)
ans =
9.81014963099981e-13
function dydt = fun(t,y,b)
s = y(1);
u = y(2);
p = y(3);
r = y(4);
M = [u s 0 0;u^2 2*s*u 0 0;0 0 u^2*s*sin(p) 0;0 0 0 1];
rhs = [(sin(b)^3)/(4*((cos(b)*cos(t)).^2));cos(b)*(sin(b)^3)/(4*((cos(b)*cos(t)).^2));(2*r/52) - (sin(p).^2)*(sin(b)^3)/(4*((cos(b)*cos(t)).^2))-u^2*s*sin(p);r*cot(p)];
dydt = M\rhs;
end
Seems to work okay to me (modulo the repeated warnings that you have singular or near-singular matrices involved in your rhs.) Looks like your M matrix, constructed using the values of your initial conditions, is pretty badly conditioned (and I'm guessing element (3, 3) only gets smaller as the ODE solver progresses.)
If you're seeing different behavior please show us the exact code you're running and the full and exact text of any warning and/or error messages you receive (all the text displayed in orange and/or red in the Command Window.)
Though since b only appears in fun as the input to sin or cos I'd skip the deg2rad call (converting 45 degrees into radians) and use the degree-based trig functions sind and cosd instead of the radian-based sin and cos.
Torsten
Torsten el 17 de Ag. de 2023
Can you resolve this issue??
No. I just implemented your equations correctly, but you are the only person who knows what they model and thus where the problem integrating them may stem from.

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 17 de Ag. de 2023
Here with mechanically generated numeric functions based on your symbolic code. If this does not work then either
  • your symbolic expressions are wrong; or
  • your initial conditions are wrong; or
  • your system is too unstable for numeric computations
b = deg2rad(45);
tspan = [0 pi];
y0 = [0.10 3.14e-06 1.4706 145.60];
syms u(t) s(t) p(t) r(t) t
eq01 = u*diff(s,t) + s*diff(u,t) == (sin(b)^3)/(4*((cos(b)*cos(t)).^2));
eq02 = (u.^2)*diff(s,t)+(2*s*u)*diff(u,t) == cos(b)*(sin(b)^3)/(4*((cos(b)*cos(t)).^2));
eq03 = (u.^2*s)*(1+diff(p,t))*sin(p) == (2*r/52) - (sin(p).^2)*(sin(b)^3)/(4*((cos(b)*cos(t)).^2));
eq04 = diff(r,t) == r*cot(p);
eqs = [eq01, eq02, eq03, eq04];
vars = [u(t), s(t), p(t), r(t)];
[eqs,vars] = reduceDifferentialOrder(eqs, vars)
eqs = 
vars = 
[M,F] = massMatrixForm(eqs,vars)
M = 
F = 
f = M\F
f = 
odefun = odeFunction(f,vars)
odefun = function_handle with value:
@(t,in2)[(1.0./cos(t).^2.*(sqrt(2.0).*in2(1,:)-1.0).*(-1.0./8.0))./(in2(2,:).*in2(1,:));(1.0./in2(1,:).^2.*1.0./cos(t).^2.*(sqrt(2.0).*in2(1,:).*2.0-1.0))./8.0;(1.0./in2(1,:).^2.*1.0./cos(t).^2.*(sqrt(2.0).*sin(in2(3,:)).^2.*1.3e+1-in2(4,:).*cos(t).^2.*4.0+in2(2,:).*in2(1,:).^2.*cos(t).^2.*sin(in2(3,:)).*1.04e+2).*(-1.0./1.04e+2))./(in2(2,:).*sin(in2(3,:)));in2(4,:).*cot(in2(3,:))]
[T,Y] = ode15s(odefun, tspan, y0);
Warning: Failure at t=6.324962e-09. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.323489e-23) at time t.
plot(T, Y)
  3 comentarios
Torsten
Torsten el 21 de Ag. de 2023
Editada: Torsten el 21 de Ag. de 2023
The error is not a question of how to write the equations, but of the validity of the equations themselves.
So check them again and the initial guesses you provide.
E.g. if s(t) becomes 0, M^(-1) no longer exists.

Iniciar sesión para comentar.

Categorías

Más información sobre Programming en Help Center y File Exchange.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by