main.cpp
来自「显示奇怪非混沌吸引子. 获得数据后, 用外部软件: origin等画出.」· C++ 代码 · 共 50 行
CPP
50 行
#include <iostream.h>
#include <fstream.h>
#include <math.h>
void main()
{
double temp[2];
double x,th;
double r,w,e;
w=(sqrt(5)-1)/2.0;
r=3.8335;
e=0.00192;
temp[0]=0.5;temp[1]=0.5;
ofstream of("attra.txt");
for(long i=0;i<50000;i++)
{
//////////////
x=temp[0];
th=temp[1];
x=r*x*(1-x)+e*cos(2*3.1415926*th);
th=(th+w);
if(th>1) ///ȡģ
{
long flag=0;
while(flag==0)
{
th=th-1;
if(th<1)
flag=1;
}
}
else
{
long flag=0;
if(th<0.0)
{
th=th+1;
if(th>0.0)
flag=1;
}
}
temp[0]=x;
temp[1]=th;
if(i>40000)
of<<x<<" "<<th<<endl;
}
/////////////////
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?