not enough input arguments

조회 수: 6 (최근 30일)
Jia Qing
Jia Qing 2023년 5월 27일
댓글: Jia Qing 2023년 5월 27일
Hi, Im trying to calculate the energy of this signal. I can't seem to locate the error and i dont know if I defined the inline function correctly. The function has no time interval. Error messages for this code are 'Not enough input argument' and 'Error in indexing'.
This is my code:
f=inline('(4*exp^(-x/10))*rectangularPulse((x-4)/3)','x')
syms x
int((f(x))^2,x);
Not sure where it went wrong.
Help is appreciated and thanks.

채택된 답변

VBBV
VBBV 2023년 5월 27일
syms x
f=inline('(4*exp(-x/10))*rectangularPulse((x-4)/3)','x');
int((f(x))^2,x)
ans = 
  댓글 수: 2
VBBV
VBBV 2023년 5월 27일
In the inline function , it seems you have combined Excel & Matlab syntaxes together, for exp function. In excel if you want to compute power a ^ symbol is used, but when you use exp it means a function which has definite syntax
y = exp(4)
y = 54.5982
y = exp^(4)
Error using exp
Not enough input arguments.
Jia Qing
Jia Qing 2023년 5월 27일
OMG i did not know that! Thanks for your help!

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by