필터 지우기
필터 지우기

Invalid use of operator.

조회 수: 7 (최근 30일)
Tobenna Uzuegbunam
Tobenna Uzuegbunam 2021년 1월 20일
댓글: Tobenna Uzuegbunam 2021년 1월 20일
I'm try to perfom the simple equation:
i.e. the square root of the integral of the square of the signal (averaged av(t)).
But I keep getting the error message "Invalid use of operator.". Please help, I'm very new to MATLAB
Where av(t) = -8.1284e-05
t_full = 1.2726e+04
av(t) = -8.1284e-05
T = 1.2726e+04
int = sqrt(@(t).* (av(t))^2);
MSDV = quadgk(int,0,t_full);
  댓글 수: 1
Tobenna Uzuegbunam
Tobenna Uzuegbunam 2021년 1월 20일
Just a correction on the code used...
av(t) = -8.1284e-05
T = 1.2726e+04
int = sqrt(@(t).* (av(t))^2);
MSDV = quadgk(int,0,T);

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

채택된 답변

Steven Lord
Steven Lord 2021년 1월 20일
int = sqrt(@(t).* (av(t))^2);
That is not valid. You're not multiplying the square of av(t) by anything.
int = sqrt(@(t) (av(t))^2);
  댓글 수: 3
Steven Lord
Steven Lord 2021년 1월 20일
My mistake, I only focused on the operator. The square root operator needs to be inside the anonymous function.
int = @(t) sqrt(av(t)^2);
And you probably want to vectorize your function.
int = @(t) sqrt(av(t).^2);
Tobenna Uzuegbunam
Tobenna Uzuegbunam 2021년 1월 20일
Thank you!

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by