小编Mat*_*ias的帖子

如何将numpy数组写入.txt文件,从某一行开始?

我需要将3个numpy数组写入txt文件.该文件的头部看起来像这样:

#Filexy
#time  operation1 operation2
Run Code Online (Sandbox Code Playgroud)

numpy数组如下所示:

time = np.array([0,60,120,180,...])
operation1 = np.array([12,23,68,26,...)]
operation2 = np.array([100,123,203,301,...)]
Run Code Online (Sandbox Code Playgroud)

最后,.txt文件应该如下所示(分隔符应该是一个选项卡):

#Filexy
#time  operation1 operation2
0   12   100
60  23    123
120  68   203
180  26   301
..  ...   ...
Run Code Online (Sandbox Code Playgroud)

我尝试了"numpy.savetxt" - 但我没有得到我想要的格式.

非常感谢您的帮助!

python numpy writetofile

5
推荐指数
1
解决办法
2955
查看次数

Matplotlib:更改绘图位置

我使用图形大小(不应更改)绘制了以下图:

plt.figure(figsize=(14, 5))
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

不幸的是,x 标签并不完全可见。我的问题:是否有可能将整个图形移到顶部(因为有足够的空间)?

编码:

plt.figure(figsize=(14, 5))
plt.plot(time_load,load, linewidth=1.5)
plt.grid(True)
plt.tick_params(labelsize=16)
plt.xlabel('Time [hours]',fontsize=16)
plt.xlim([0,24])
plt.xticks([0,4,8,12,16,20,24])
plt.legend(loc="upper left",fontsize = 'large')
Run Code Online (Sandbox Code Playgroud)

非常感谢您的帮助!

python matplotlib

4
推荐指数
3
解决办法
2万
查看次数

Modelica linear analysis

I am new into Modelica/Dymola-modeling. I started to model fluid models for my master-thesis (pipes, heaters, control). My professor suggested: Check the eigenvalues of the systems and the ratio of them (and if the systems is stiff). So did the following:

  • Linear analysis
  • Full linear analysis
  • SimulationSetup: linearizeAtInitial = false; t_linearize = 1000 (that the system is in operation mode (after initialization)

The simulation restuls are Ok.

But the linear analysis says: The system is not stable --> what does …

linearization eigenvalue modelica

4
推荐指数
1
解决办法
328
查看次数