Not enough input arguments

조회 수: 15 (최근 30일)
Zzahng Cal
Zzahng Cal 2022년 4월 6일
댓글: Zzahng Cal 2022년 4월 9일
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
Mujtaba Farrukh
Mujtaba Farrukh 2022년 4월 6일
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 2022년 4월 9일
thank you!

댓글을 달려면 로그인하십시오.

채택된 답변

MJFcoNaN
MJFcoNaN 2022년 4월 6일
"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
Zzahng Cal
Zzahng Cal 2022년 4월 9일
exactly that! thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by