Invalid use of operator.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tobenna Uzuegbunam
el 20 de En. de 2021
Comentada: Tobenna Uzuegbunam
el 20 de En. de 2021
I'm try to perfom the simple equation:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/494949/image.png)
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);
Respuesta aceptada
Steven Lord
el 20 de En. de 2021
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 comentarios
Steven Lord
el 20 de En. de 2021
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);
Más respuestas (0)
Ver también
Categorías
Más información sobre Biological and Health Sciences en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!