使用以下离散化
使用边界条件 并坐 lc=1/(6*sqrt(3)),但我没有像下图那样到达分岔图,
这是我使用的代码。
#include <iostream>
#include <math.h>
#include <fstream>
#include <cstdio>
#define PI 3.14
using namespace std;
main (){
int i,n,m;
double a=0,b=PI,h,l,BETA=PI*PI;
double X[500],V[500], T[500];
cout<<"donne n=";
cin>>n;
l=1./(2*n*sqrt(3));
ofstream SOL("eringen.txt");
V[0]=0;
V[100]=0;
X[0]=5;
//SOL << X[0]<<"\t"<< V[0] << endl;
for (m=1; m<=100; m++)
{
for (i=1; i<=10; i++)
{
X[i]=X[i-1]+(1./m)*V[i-1];
V[i]=V[i-1]-(1./m)*BETA*(1+l*l*V[i-1]*V[i-1])*sin(X[i])*(1./(1-BETA*l*l*cos(X[i])));
SOL << X[i-1]<<"\t"<< V[i-1] << endl;
}
}
FILE *fp = popen("gnuplot", "w");
fprintf(fp,"plot 'eringen.txt' ;\ pause mouse \n");
cin.get();
pclose(fp);
}