Not enough input arguments

19 vues (au cours des 30 derniers jours)
Zzahng Cal
Zzahng Cal le 6 Avr 2022
Commenté : Zzahng Cal le 9 Avr 2022
Hi, I'm really confused with the error on my code.. can someone help me point out which part of this did I mistype or something? What exactly does "not enough input arguments" mean? SOS T_T
%problem: f(x)= (3cosx-sinx)e^-0.2x for -4<=x<=9
clc;
x = [-4:1:9];
y = (3*cos(x)-sin(x))*(exp.^-0.2*x);
plot(x,y,'Linewidth',2), xlabel('x ->'), ylabel('y ->'), title('plot for -4 <= x <= 9');
grid
there's an error message that says:
  2 commentaires
Mujtaba Farrukh
Mujtaba Farrukh le 6 Avr 2022
Use this code:
clc;
x = -4:9;
y = (3*cos(x)-sin(x)).*(exp(-0.2*x));
plot(x,y,'-or','Linewidth',2), xlabel('x ->'), ylabel('y ->'), title('plot for -4 <= x <= 9');
grid minor
axis tight
Zzahng Cal
Zzahng Cal le 9 Avr 2022
thank you!

Connectez-vous pour commenter.

Réponse acceptée

MJFcoNaN
MJFcoNaN le 6 Avr 2022
"exp" is a function, not a number. I guess this is what you need:
y = (3*cos(x)-sin(x)).*exp(-0.2*x);
  1 commentaire
Zzahng Cal
Zzahng Cal le 9 Avr 2022
exactly that! thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by