Ode45 too many input arguments

clc; clear all; close all;
y0=1;
tSpan=[0 10];
[t,y]=ode45(@(t,y) mas(t,y), tSpan, y0);
plot(t,y)
function dt = mas(t,y)
dt=-2*y-t;
end
Hey can anyone please help, i tried using ode45 for a simple function, but i always get the error message:
Error using ode45
Too many input arguments.
Error in programstart (line 8)
[t,y]=ode45(@(t,y) mas(t,y), tSpan, y0);
Why is this?
thanks in advance

4 件のコメント

Ameer Hamza
Ameer Hamza 2020 年 4 月 1 日
The code works fine when I run it on my PC, which MATLAB version are you using? Have you pasted all this code in one script?
Davide Masiello
Davide Masiello 2020 年 4 月 1 日
It works fine on my PC too.
Marcus Stürup
Marcus Stürup 2020 年 4 月 1 日
Im using matlab 2020a. The whole code is in one scribt.
James Tursa
James Tursa 2020 年 4 月 1 日
What does this show
which ode45

サインインしてコメントする。

回答 (0 件)

カテゴリ

製品

タグ

質問済み:

2020 年 4 月 1 日

コメント済み:

2020 年 4 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by