Escolar Documentos
Profissional Documentos
Cultura Documentos
0.2
0.4
Sv vs Time Period
0.6
0.8
1.2
1.4
1.6
0.1
0.01
Sv in the range of 0.6 to 33
0.001
0.0001
0.2
0.4
0.6
0.8
1.2
1.4
1.6
0.1
0.01
0.001
0.0001
CODE
#include <iostream>
#include <fstream>
#include <math.h>
#include <iomanip>
using namespace std;
int main(){
int i,j,k;
float a[1600], zeta1=0.05, zeta2=0.02, a11=0, a12=0, a21=0, a22=0, b11=0, b12=0, b21=0,
b22=0,power=0,delt=0.02, zeta_ratio=0.0;
float omega=0.1, x[1600], xdot[1600], max_x[400], max_xdot[400], omegad=0.1, ratio_1=1,
ratio_2=1, pi=3.14159265359;
ofstream myfile;
ifstream infile ("elcentro/data.dat");
i=0;
if (infile.is_open())
{
while ( infile.good() )
{
infile>>a[i];
i++;
if (i>=1559)
break;
}
infile.close();
}
else cout << "Unable to open file";
zeta_ratio=zeta1/sqrt(1-zeta1*zeta1);
for (omega=0.1*2*pi, k=0; omega<=33*2*pi; omega=omega+0.1*2*pi, k++) {
power=exp(-1*zeta1*omega*delt);
omegad=omega*sqrt(1-zeta1*zeta1);
ratio_1= (2*zeta1*zeta1-1)/(omega*omega*delt);
ratio_2= (2*zeta1)/(omega*omega*omega*delt);
a11= power*( cos( omegad*delt ) + zeta_ratio*sin( omegad*delt ));
a12= power/omegad * sin( omegad*delt );
a21= -1*omega/sqrt(1-zeta1*zeta1) * power * sin( omegad*delt );
a22= power*( cos( omegad*delt ) - zeta_ratio*sin( omegad*delt ));