8.) write a c/c+script to calculate table of the magnitude and phase ange of the
ID: 3785987 • Letter: 8
Question
8.) write a c/c+script to calculate table of the magnitude and phase ange of the filter voltage gain versus log10 of the radian ofa low pass Rc filter over the range of radian frequency break frequency o 1.wb to of o.1.wb. the filter the frequency. A make a polar table of the absolute value of the filter gain versus phase angle of the gain. Use the following formulas: Gain absolute value of (1/(1+j w R c) Angle--atan2 w R 9.) For the following two functions, calculate table of values for (a) The real and imaginary parts of G1 and G2 versus angle Ain radians (b) The polar magnitude of G1 and G2 versus the input angle A Polar magnitude sqrt (real part real part imag part mag part) (c) The output angle of G1 and G2 versus the Input angle A). output angle atan2(imag part/realpart 180/M Pl; G1 3 (1-cos(A)) (1-cos(A)) j sin (A A2))Explanation / Answer
7)
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
double table[500][3];
int x,k;
int i=0;
for(x=1;x<=25;x++)
{
for(k=50;k<=500;k+=25,i++)
{
table[i][0]=x;
table[i][1]=k;
table[i][2]=0.5*k*x*x*x;
}
}
int count =i;
cout << "Displacement Spring_Constant Energy_stored " << endl;
for(i=0;i<count;i++)
{
cout <<table[i][0] << " " << table[i][1] << " " << table[i][2] << endl;
}
}
------------------------------------------------------------------------------------------------------------------------------------------------
8)
#include<iostream>
#include<math.h>
#include<stdlib.h>
using namespace std;
int main()
{
double table1[10][3];
double polar_table[10][2];
double R= 100,C=100;
double Wb=1/(R*C);
double W= 0.1*Wb;
double j = sqrt(-1);
for(int i=0;i<10;i++)
{
table1[i][0]=W*R*C;
table1[i][1]= -1*atan(W*R*C); //I am not sure what is written in ur text book for this.
table1[i][2] = log10 (W);
polar_table[i][0] = abs(1/(1+j*W*R*C));
polar_table[i][1] = -1*atan(W*R*C);
W+=0.1*Wb;
}
cout << "Magnitude PhaseAngle log10(W)"<<endl;
for(int i=0;i<10;i++)
{
cout << table1[i][0] << " "<<table1[i][1] << " " << table1[i][2] << endl;
}
cout << "AbsoluteValueOfFilterGain phaseAngle"<<endl;
for(int i=0;i<10;i++)
{
cout << polar_table[i][0] << " "<<polar_table[i][1] << endl;
}
return 0;
}
-----------------------------------------------------------------------------------------------------------------------------------------------------
9)
#include<iostream>
#include<math.h>
using namespace std;
#define pi 3.14
#define M_PI 3.14
int main()
{
double table1[14][5];
double polar_magnitude[14][3];
double table3[14][3];
double A = pi/7;
double j = sqrt(-1);
int i;
for(i=0;i<14;i++)
{
double real_G1=3*(1-(cos(A))*(1-cos(A)));
double imag_G1=3*(sin(A*pow(A,2))); // this is A2 or A to the power 2
double real_G2=8*A + 8*A*exp(-A*j);
double imag_G2=8*A*(sin(0.5*A)*cos(-2*A));
table1[i][0] = A;
table1[i][1] = real_G1;
table1[i][2] = imag_G1;
table1[i][3] = real_G2;
table1[i][4] = imag_G2;
//---------------
polar_magnitude[i][0] = A;
polar_magnitude[i][1]= sqrt(real_G1*real_G1 + imag_G1*imag_G1);
polar_magnitude[i][2]= sqrt(real_G2*real_G2 + imag_G2*imag_G2);
table3[i][0] = A;
table3[i][1] = atan2(imag_G1,real_G1)*180/M_PI;
table3[i][2] = atan2(imag_G2,real_G2)*180/M_PI;
A += pi/7;
}
cout << "Angle_A real_G1 imag_G1 real_G2 imag_G2" << endl;
for(i=0;i<14;i++)
{
cout <<table1[i][0] << " " << table1[i][1] << " " << table1[i][2] << " " <<table1[i][3] << " " << table1[i][4] << endl;
}
cout << "Angle_A Polar_magnitude_G1 Polar_magnitude_G2" << endl;
for(i=0;i<14;i++)
{
cout << polar_magnitude[i][0] << " " << polar_magnitude[i][1] << " " << polar_magnitude[i][2] << endl;
}
cout << "Angle_A Output_Angle_G1 Output_Angle_G2" << endl;
for(i=0;i<14;i++)
{
cout << polar_magnitude[i][0] << " " << polar_magnitude[i][1] << " " << polar_magnitude[i][2] << endl;
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.