Illegal use of reserved keyword "end".
81 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
David Scidmore
il 8 Mag 2021
Risposto: Cris LaPierre
il 8 Mag 2021
[T,Y] = ode45(@Bqfun1,[0 2],[1 1 -0.01]);
plot (T,Y(:,1),'b','linewidth',1)
function dy1 = Bqfun1(t,y)
dy1 = zeros(2,1);
dy1=[y(2);
y(3)
-3*y(3)-3*y(2)-y(1)-4*sin(t);
end
With the end in there
Error: File: Test4.m Line: 14 Column: 1
Illegal use of reserved keyword "end".
if I remove the end
Error: File: Test4.m Line: 17 Column: 1
All functions in a script must be closed with an 'end'.
Make up your mind MATLAB.
How do I put the end in for the function without the illegal use of reserved keyword "end."
0 Commenti
Risposta accettata
Cris LaPierre
il 8 Mag 2021
The problem is you forgot the closing bracket when creating dy1.
[T,Y] = ode45(@Bqfun1,[0 2],[1 1 -0.01]);
plot (T,Y(:,1),'b','linewidth',1)
function dy1 = Bqfun1(t,y)
dy1 = zeros(2,1);
dy1=[y(2)
y(3)
-3*y(3)-3*y(2)-y(1)-4*sin(t)];
end
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!