I have a function statement that works in Octave but fails in Matlab
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
my code in Octave is
for j= 1:12
I(j)= Io +j*DI;
j
x
[x ,fval] = fsolve(@(x) f(x,I(j)), x0, options);
y1(j)= x(1)
y2(j)= x(2)
x0 = x
endfor
plotyy (I , y1 , I , y2 )
function [y] = f( x , I )function [y] = f( x , I )
MAtlab says
Error: File: CurrentagainstT.m Line: 20 Column: 1
Function definition not supported in this context. Create functions in code file.
What am I supposed to do
3 Commenti
Risposte (1)
Star Strider
il 29 Dic 2019
In most instances, only anonymous functions can occur in a script file in MATLAB.
- Starting in R2016b, another option for storing functions is to include them at the end of a script file.
so it is possible, with some restrictions. See the cited (and related) documentation for details.
0 Commenti
Vedere anche
Categorie
Scopri di più su Octave 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!