How to get spectrogram of an array in MATLAB?
13 views (last 30 days)
Show older comments
Bridgit Schneider
on 21 May 2020
Commented: Star Strider
on 21 May 2020
So.. I want to make spectrogram out of 4 signals that i need to add in array.
When I add them in array, it looks like this s=[x1 x2 x3 x4]; or with values: [1 1 0 1] But I'm not sure if it's proper adding..
Example of signal si this:
f1=1000; t1=0.2; x1=cos(2*pi*f1*t1);
so x1 is 1.
Is there a way of making spectrogram out of s?
0 Comments
Accepted Answer
Star Strider
on 21 May 2020
The documentation states that the input signal is ‘specified as a row or column vector’, so you would need to loop through each column of ‘s’, saving the results (outputs you will need to request in your code) in appropriate cell arrays.
Example —
for k = 1:size(s,2)
[sp{k},w{k},t{k}] = spectrogram(s(:,k));
end
Add other arguments to the spectrogram call as necessary to produce the results you want.
6 Comments
More Answers (0)
See Also
Categories
Find more on Time-Frequency Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!