Invalid syntax error with a simple code
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Ahmad Jundi
il 5 Nov 2020
Commentato: Ahmad Jundi
il 5 Nov 2020
I am trying to write a simple MatLab code but continue to get an error that I can't find a fix for.
x = [-2 -1.5 -1 -0.5 0 0.5 1 1.5 2];
y = (x+x(sqrt(x+3)))*(1+2(x^(2)));
The error is at line 2, on the parenthesis that is bolded between the 2 and x. Any reason why?
Error: File: Assignment2.m Line: 2 Column: 26
Invalid expression. When calling a function or
indexing a variable, use parentheses. Otherwise,
check for mismatched delimiters.
0 Commenti
Risposta accettata
Rafael Hernandez-Walls
il 5 Nov 2020
tray this
x = [-2 -1.5 -1 -0.5 0 0.5 1 1.5 2];
y = (x+x.*(sqrt(x+3))).*(1+2*(x.^(2)));
2 Commenti
Walter Roberson
il 5 Nov 2020
Right. MATLAB has absolutely NO implied multiplication, anywhere. Not even inside the symbolic toolbox internal language.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Get Started with MATLAB 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!