I am new to FreeFem and am trying to plot eigenvector for v in matlab.
the freefem++ code is:
real Mj=0.9; // mach number
complex I = 1i;
real ga=1.4; //gamma
real M2=(1/(gaMjMj));
real Re;
cout<<“Enter Reynold’s number”<<endl;
cin>>Re;
real om,alp,bet;
// defining the type of stability problem
int a,b;
cout<<“Enter 1 for spatial stability and 2 for temporal stability\n”<<endl;
cin>> a;
if(a==1)
{
cout<<“Enter wave frequency\n”<<endl;
cin>>om;}
else{
cout<<“Enter streamwise wave number\n”<<endl;
cin>>alp;
cout<<“Enter spanwise wave number\n”<<endl;
cin>>bet;}
mesh Th;
int m=300;
real h=1./m;
Th=square(1,m);
Th = emptymesh(Th);
fespace Vh(Th,P2,periodic=[[2,y],[4,y],[1,x],[3,x]]);
fespace Mh(Th,P1,periodic=[[2,y],[4,y],[1,x],[3,x]]);
fespace Gh(Th,[P2,P2,P2,P1]);
Vh W,Wy;
Vh u,v,w,a1,a2,a3;
Mh p,a4;
W=2*y-1;
Wy=2;
real lambda=(10^18);
matrixA1;
matrix B1;
cout<<“Welcome\n”;
real sigma=0.0006;
real lamb=10^10;
varf A([u,v,w,p],[a1,a2,a3,a4])=int2d(Th)(a1*(Wbet-I(alp^2+bet^2)/(Re))u-I(1/Re)dy(a1)dy(u)+a1alpp+
a2*(Wbet-I(alp^2+bet^2)/(Re))v-I(1/Re)dy(a2)dy(v)+Idy(a2)p
+a3Wyw+a3w(Wbet-I(alp^2+bet^2)/(Re))-I*(1/Re)dy(a3)dy(w)+a3betp-sigmaa1u-sigmaa2v-sigmaa3w +a4alpu-Ia4dy(v)+a4betw )+on(1,3,u=0,v=0,w=0);
varf B([u,v,w,p],[a1,a2,a3,a4])=int2d(Th)(a1*u+a2*v+a3*w);
A1=A(Gh,Gh);
B1=B(Gh,Gh);
ofstream file("A1.csv");
for (int i = 0; i < A1.m; i++) {
for (int j = 0; j < A1.n; j++) {
if(imag(A1(i,j))>0){file<<real(A1(i,j))<<“+”<<imag(A1(i,j))<<“i”;}
else{file<<real(A1(i,j))<<imag(A1(i,j))<<“i”;}
if (j < A1.m - 1) {
file<< “,”;
}
}
file << endl;
}
ofstream file1("B1.csv");
for (int i = 0; i < B1.n; ++i) {
for (int j = 0; j < B1.m; ++j) {
if(imag(B1(i,j))>0){file1<<real(B1(i,j))<<“+”<<imag(B1(i,j))<<“i”;}
else{file1<<real(B1(i,j))<<imag(B1(i,j))<<“i”;}
if (j < B1.m - 1) {
file1<< “,”;
}
}
file1<< endl;
}