I have one vector ( newdata
) consisting of 4100 lines and one column. To be exact, those elements are the counts of a spectrum. What I want is to reproduce the spectrum using MATLAB. That's why I created a new vector:
channels=[1:size(newdata,1)];
I tried to plot the spectrum (using channel
in x axis and newdata
as a weight) by typing:
hist(channels,newdata)
But I got an error
??? Error using ==> histc
Edges vector must be monotonically non-decreasing.
Error in ==> hist at 86
nn = histc(y,[-inf bins],1);
How can I draw the desired spectrum?
尝试使用bar
命令进行绘图
bar( channels, newData );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.