error with function ode45

12 vues (au cours des 30 derniers jours)
Cesar Cardenas
Cesar Cardenas le 21 Fév 2023
Commenté : Cesar Cardenas le 21 Fév 2023
Hello,I created this function and file but I'm getting this error:
not sure what I'm doing wrong. Any help will be greatly appreciated.
Error using odearguments
When the first argument to ode45 is a function handle, the tspan argument must have at least two elements.
Error in ode45 (line 107)
odearguments(odeIsFuncHandle,odeTreatAsMFile, solver_name, ode, tspan, y0, options, varargin);
Error in blasius_solution (line 6)
[eta, f] = ode45 (@mufun, 0.5, [0; 0; guess]);
function dfdeta = mufun (eta, f)
dfdeta = [f(2); f(3); -0.5 * f(1) * f(3)];
end
clear all;
close all;
guess = 0.1;
[eta, f] = ode45 (@mufun, 0.5, [0; 0; guess]);
plot(f, eta);

Réponses (1)

John D'Errico
John D'Errico le 21 Fév 2023
You need to tell the ODEsolver FROM where, TO where will it integrate? So will the integration be, perhaps FROM 0 to 0.5?
All you have passed in is a scalar, the number 0.5. Should it be able to guess?
  1 commentaire
Cesar Cardenas
Cesar Cardenas le 21 Fév 2023
finally, I could solve it. thanks

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by