invalid use of operator
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to create an exponential function and then use the data for another script. To be more specific, I have a script file with an exponential function, but every single time I run the code I get the message: File: modfunc.m Line: 1 Column: 27
Invalid use of operator.
Here is the code:
function out = modfunc(x,a:end);
out = a(1)*exp(a(2)*x);
|x| representing time and |a| vector a with two values representing the coefficients.
2 commentaires
Réponses (2)
John D'Errico
le 6 Fév 2023
Looks great. Except, what you have written is not valid MATLAB syntax.
Why do you think you needed to include the :end in there? a is a vector of length 2. No problem.
function out = modfunc(x,a);
out = a(1)*exp(a(2)*x);
Sulaymon Eshkabilov
le 6 Fév 2023
The corrected syntax of this is:
function out = modfunc(x,a);
out = a(1)*exp(a(2)*x);
2 commentaires
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!