error with function ode45

6 views (last 30 days)
Cesar Cardenas
Cesar Cardenas on 21 Feb 2023
Commented: Cesar Cardenas on 21 Feb 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);

Answers (1)

John D'Errico
John D'Errico on 21 Feb 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?

Community Treasure Hunt

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

Start Hunting!