How to sum particular values on the y axis
1 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1372959/image.jpeg)
I wish to sum the y axis values for the frequencies between 300Hz to 1000Hz, how do I do this?
0 个评论
回答(1 个)
Torsten
2023-5-3
移动:Torsten
2023-5-3
X = 0:1300;
Y = rand(size(X))
s = sum(Y(X>=300 & X<=1000))
7 个评论
Torsten
2023-5-3
编辑:Torsten
2023-5-3
I wish to sum the value of each curve, I have used your code to do this. Does the code now look fine to sum over these ten curves?
Yes, if by "summing" you really mean "summing the Y-values". If you mean "integrate over the Frequency", you will have to multiply the result by "sampleFreq/burst_length". Or use "trapz".
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!