i want to draw a graph
    4 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
i want to draw a graph on just command window.
f(x)=(exp(x).*sin(x)+(x./exp(x))
on 0<=x<=2*pi
but i got error! how i fix ?
>> f=@(x)(exp(x).*sin(x)+(x./exp(x))
x=linspace(0,2*pi,200);
error: parse error:
  anonymous function bodies must be single expressions
>>> x=linspace(0,2*pi,200);
    ^
>>
0 commentaires
Réponse acceptée
  Voss
      
      
 le 29 Avr 2022
        You are missing a close parenthesis
f=@(x)(exp(x).*sin(x)+(x./exp(x))
%     ^ no matching close parenthesis for this
That open parenthesis is not necessary, so you can remove it:
f=@(x)exp(x).*sin(x)+(x./exp(x))
or add a close parenthesis on the end of the line:
f=@(x)(exp(x).*sin(x)+(x./exp(x)))
2 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Migrate GUIDE Apps 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!

