如何画时频图?
sig=real(amgauss(128).*fmlin(128));figure(1) ; plot(sig,'LineWidth',2);xlabel('时间 t'); ylabel('幅值 A');
h=1;
sig=hilbert(sig); =tfrstft(sig,1:128,128,h);
figure(2)
contour(t,f(1:length(f)/2),abs(tfr));xlabel('时间 t'); ylabel('频率 f');
??? Error using ==> contour at 68
The size of Y must match the size of Z or the number of rows of Z
请问要怎么修改。。。看了置顶帖了,不过还是不明白。。。谢谢了!!!
[ 本帖最后由 ChaChing 于 2009-6-2 17:44 编辑 ]
回复 楼主 rtbit 的帖子
help contourand try
pcolor(t,f,abs(tfr));
[ 本帖最后由 ChaChing 于 2009-6-2 17:45 编辑 ] 谢谢楼上的。不过用contour(t,f,abs(tfr))出的图与需要的图不一样。。。
我有这段程序的结果,但是要用这段程序做其他的,所以想要知道问题出在哪。 已经有提示了:
??? Error using ==> contour at 68
The size of Y must match the size of Z or the number of rows of Z
说明f(1:length(f)/2)的大小和abs(tfr)的大小不匹配 谢谢,知道提示什么意思,但是不知道怎么修改。 contour(Z) draws a contour plot of matrix Z, where Z is interpreted as heights with respect to the x-y plane. Z must be at least a 2-by-2 matrix that contains at least two different values. The number of contour levels and the values of the contour levels are chosen automatically based on the minimum and maximum values of Z. The ranges of the x- and y-axis are and , where = size(Z).
例如:
>> z=rand(10,20);
>> contour(1:20,1:10,z)
页:
[1]