Confusion in matrix multiplication
2 views (last 30 days)
Show older comments
Dear all, the magnitude of the second graph does not make any sence: why is it so low?
These are absolutely same vectors, but the second graph is just truncated to half of the first one.The vector "frequency_domain" is real-valued, the vector "spectrum_normalized" is complex-valued.
Could you please help me to fix it?
Thank you in advance!
UPD: spectrum_normalized was just a matrix, not a vector, due to a typo.... Check dimensions first.
0 Comments
Accepted Answer
Voss
on 25 Nov 2024
spectrum_normalized is a matrix (I know that because subplot(2,4,2) contains many lines). Thus, to plot the one-sided spectrum, you'd plot the first N/2 rows or the first N/2 columns, not the first N/2 elements, i.e.:
plot(frequency_domain(1:N/2), abs(spectrum_normalized(1:N/2,:)));
% or
plot(frequency_domain(1:N/2), abs(spectrum_normalized(:,1:N/2)));
% but not
plot(frequency_domain(1:N/2), abs(spectrum_normalized(1:N/2)));
depending on whether each row or each column of spectrum_normalized corresponds to an element of the vector frequency_domain.
7 Comments
More Answers (0)
See Also
Categories
Find more on Annotations 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!