我的信号分析课程老师给了我一些我必须执行的Matlab代码才能完成一个家庭作业.我一直在使用GNU Octave没有麻烦,但这一次有这个命令令我头疼.
[c8,g8]=fit(time, sin_4_harmonic,’fourier8’)
Run Code Online (Sandbox Code Playgroud)
我找不到GNU Octave中的"fit"函数,它在下面的url http://www.mathworks.se/help/curvefit/fit.html中为Matlab引用
有谁知道我应该加载哪个包,或者是否有任何等价物?
谢谢=)
我需要创作一部电影.假设,我创建了一个轴并在其上绘制了一些非常自定义的东西:
figure;
ax = plot(x, y, 'linewidth', 3, 'prop1', value1, 'prop2', value2, ...);
grid minor;
axis(ax, [xmin xmax ymin ymax]);
legend(ax, ...);
xlabel(ax, ...);
ylabel(ax, ...);
title(ax, ...);
Run Code Online (Sandbox Code Playgroud)
现在我运行一个循环,其中只y更新值.
for k = 1 : N
% y changes, update the axis
end
Run Code Online (Sandbox Code Playgroud)
使用new y(或x和y)更新轴的最快和最简单的方法是什么,保留所有轴属性?
我想让在我的散点图中按下一个点时可以显示值。在这里找到了解决方案:将鼠标悬停在 matplotlib 中的一个点上时,可以显示标签吗?
解决方案:
from matplotlib.pyplot import figure, show
import numpy as npy
from numpy.random import rand
# picking on a scatter plot (matplotlib.collections.RegularPolyCollection)
x, y, c, s = rand(4, 100)
def onpick3(event):
ind = event.ind
print 'onpick3 scatter:', ind, npy.take(x, ind), npy.take(y, ind)
fig = figure()
ax1 = fig.add_subplot(111)
col = ax1.scatter(x, y, 100*s, c, picker=True)
#fig.savefig('pscoll.eps')
fig.canvas.mpl_connect('pick_event', onpick3)
show()
Run Code Online (Sandbox Code Playgroud)
它解决了我的问题。但我不明白是怎么回事,我一直在谷歌上搜索,没有任何运气。我知道如何用 matplotlib 绘图,所以这不是我缺乏知识的地方。
我不明白的一件事是onpick3(event)函数。这个事件参数是什么?因为函数本身是不带任何给定的参数在进一步往下叫:fig.canvas.mpl_connect('pick_event', onpick)。