Calculating the value of equation coefficients
Iz = Ix + Iy;
V1 = (Rx * Ix) + Vz;
V2 = (Ry * Iy) + Vz;
Vz = Rz * Iz;
The crammers rule is like below:
Ax + By = Z1;
Cx + Dy = Z2;
If Matrix M =
D|M| = (a*d)-(b*c);
According to crammers rule
M = Aug =
Now made new matrix M1 like below
Mx =
Now x = (D|Mx| / D|M|);
My =
Now y = (D|My| / D|M|);
In our case
(Rx + Rz) * Ix + Rz * Iy = V1;
Rx * Ix + ( Ry + Rz ) *Iy = V2;
We need to find Ix and Iy;
Now M = , Aug =
D|M| = (( Rx + Rz ) * ( Ry + Rz)) – ( Rx * Rz);
D|M1| = (V1 * (Ry + Rz)) – (V2 * Rz);
M2 =
D|M2| = ( (Rx + Rz)* V2 ) – (Rx * V1)
Ix = D|M1| / D|M|;
Iy = D|M2| / D|M|;
Here we have V1, V2 and Ry, Rz but not Rx, below is the equation to calculate the Rx
Rx = (R1 + ((R2 * R3) / (R2 + R3))) // R1 and R2 and R3 are given
Code and Implementation:
Below is the code to do above things * Calculating x and y using crammers rule void cal_x_and_y_crammers_rule(double mainM[2][2], double augM[2], double *x, double *y){
double Dx;
double Dy;
double D;
D = ((mainM[0][0] * mainM[1][1]) – (mainM[1][0] * mainM[0][1]));
Dx = ( (augM[0] * mainM[1][1]) – (augM[1] * mainM[0][1]) );
Dy = ( (mainM[0][0] * augM[1]) – (mainM[1][0] * augM[0]) );
*x = (Dx/D);
*y = (Dy/D);
* Calculating the Rx from R1, R2, R3
double cal_Rx(double R1, double R2, double R3){
return (R1 + ((R2 * R3) / (R2 + R3))); // Rx = R1 + (R2 * R3)/(R2 + R3)
Design:
Now after having calculated values Ix, Iy now calculate Iz and Vz
Iz = Ix + Iy;
Vz = Rz * Iz; // Rz is given
Code and Implementation:
double cal_IZ(double Ix, double Iy){
return (Ix + Iy);*
* Calculating Vz using Iz and Rz
double cal_Vz(double Iz, double Rz){
return (Rz * Iz); // Vz = (Iz * Rz);
Testing Modules:
Test data:
R1 = 0.6
R2 = 6;
R3 = 4;
Ry = 5;
Rz = 1;
V1 = 15;
V2 = 2;
Assumptions is given value are greater than zero. No validation done for the values
Design:
Main program:
Code:
* Calculating the Iz = Ix + Iy
double cal_IZ(double Ix, double Iy){
return (Ix + Iy);/*
* Calculating Vz using Iz and Rz
double cal_Vz(double Iz, double Rz){
return (Rz * Iz); // Vz = (Iz * Rz);
* Calculating x and y using crammers rule
void cal_x_and_y_crammers_rule(double mainM[2][2], double augM[2], double *x, double *y){
double Dx;
double Dy;
double D;
D = ((mainM[0][0] * mainM[1][1]) – (mainM[1][0] * mainM[0][1]));
Dx = ( (augM[0] * mainM[1][1]) – (augM[1] * mainM[0][1]) );
Dy = ( (mainM[0][0] * augM[1]) – (mainM[1][0] * augM[0]) );
*x = (Dx/D);
*y = (Dy/D);
* Calculating the Rx from R1, R2, R3
* */
double cal_Rx(double R1, double R2, double R3){
return (R1 + ((R2 * R3) / (R2 + R3))); // Rx = R1 + (R2 * R3)/(R2 + R3)
* The main program
int main(int argc, char *argv[]){
double R1;
double R2;
double R3;
double Rx;
double Ry;
double Rz;
double V1;
double V2;
double Vz;
double Ix;
double Iy;
double Iz;
double mainM[2][2];
double augM[2];
int choice;
printf(“nn”);
printf(“*********************PART1*************************”);
printf(“nEnter R1: “);
scanf(“%lg”, &R1);
//R1 = 0.6;
printf(“Enter R2: “);
scanf(“%lg”, &R2);
//R2 = 6;
printf(“Enter R3: “);
scanf(“%lg”, &R3);
//R3 = 4;
Rx = cal_Rx(R1, R2, R3);
printf(“nnRx calculated: %.2fnn”, Rx);
printf(“Enter Ry: “);
scanf(“%lg”, &Ry);
//Ry = 5;
printf(“Enter Rz: “);
scanf(“%lg”, &Rz);
//Rz = 1;
printf(“Enter V1: “);
scanf(“%lg”, &V1);
//V1 = 15;
printf(“Enter V2: “);
scanf(“%lg”, &V2);
//V2 = 2;
print_equations();
mainM[0][0] = (Rx + Rz);
mainM[0][1] = Rz;
mainM[1][0] = Rz;
mainM[1][1] = (Ry + Rz);
augM[0] = V1;
augM[1] = V2;
print_coeffficients_matrices(mainM, augM);
printf(“*********************PART2 & PART3 ****************”);
cal_x_and_y_crammers_rule(mainM, augM, &Ix, &Iy);
printf(“nIx and Iy are calculated, Vz = ( Rz * Iz) = ( Rz * (Ix + Iy))nn”);
printf(“Enter details 1.display to screen, details 2.saved to screen: “);
scanf(“%d”, &choice);
Vz = (Rz * (Ix + Iy));
if(choice == 1){
printf(“nIx=%.2f, Iy=%.2f, Vz=%.2fn”, Ix, Iy, Vz);
}else{
fp = fopen(“output.txt”, “a+”);
fprintf(fp, “%.2f,%.2f,%.2fn”, Ix, Iy, Vz);
printf(“Ix, Iy, Iz are saved to filen”);
fclose(fp);
printf(“n”);
Test results:
given default values in the program and written the result to screen
Test data:
Calculating the value of equation coefficients
Iz = Ix + Iy;
V1 = (Rx * Ix) + Vz;
V2 = (Ry * Iy) + Vz;
Vz = Rz * Iz;
R1 = 1.2; R2 = 10; R3 = 6;
Ry = 4; Rz = 3;
V1 = 25;
V2 = 10;
Assumptions is given value are greater than zero. No validation done for the values
Ix = 3.11;
Iy = 0.10;
Vz = 9.61;
Test case data:
Calculating the value of equation coefficients
Iz = Ix + Iy;
V1 = (Rx * Ix) + Vz;
V2 = (Ry * Iy) + Vz;
Vz = Rz * Iz;
R1 = 0.6; R2 = 6; R3 = 4; Ry = 5; Rz = 1; V1 = 15; V2 = 2;
Assumptions is given value are greater than zero. No validation done for the values
Ix = 3.11;
Iy = 0.10;
Vz = 9.61;
Essay Writing Service Features
Our Experience
No matter how complex your assignment is, we can find the right professional for your specific task. Contact Essay is an essay writing company that hires only the smartest minds to help you with your projects. Our expertise allows us to provide students with high-quality academic writing, editing & proofreading services.Free Features
Free revision policy
$10Free bibliography & reference
$8Free title page
$8Free formatting
$8How Our Essay Writing Service Works
First, you will need to complete an order form. It's not difficult but, in case there is anything you find not to be clear, you may always call us so that we can guide you through it. On the order form, you will need to include some basic information concerning your order: subject, topic, number of pages, etc. We also encourage our clients to upload any relevant information or sources that will help.
Complete the order formOnce we have all the information and instructions that we need, we select the most suitable writer for your assignment. While everything seems to be clear, the writer, who has complete knowledge of the subject, may need clarification from you. It is at that point that you would receive a call or email from us.
Writer’s assignmentAs soon as the writer has finished, it will be delivered both to the website and to your email address so that you will not miss it. If your deadline is close at hand, we will place a call to you to make sure that you receive the paper on time.
Completing the order and download