0% found this document useful (0 votes)
55 views7 pages

Codigo Del Programa en C++

This C++ program implements the Routh-Hurwitz stability criterion to analyze the stability of a system of equations. The user inputs the degree of the denominator and coefficients. The program constructs a Routh array and determines if the system is stable or unstable based on the signs of the first column of the array. It outputs the Routh array with 3 decimal places of precision. The document provides an example of the program output and lists 3 tests of the program.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views7 pages

Codigo Del Programa en C++

This C++ program implements the Routh-Hurwitz stability criterion to analyze the stability of a system of equations. The user inputs the degree of the denominator and coefficients. The program constructs a Routh array and determines if the system is stable or unstable based on the signs of the first column of the array. It outputs the Routh array with 3 decimal places of precision. The document provides an example of the program output and lists 3 tests of the program.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

CODIGO DEL PROGRAMA EN C++.

//GUTIERREZ MENDOZA JHONATAN HENRY//

#include<conio.h>

#include<stdlib.h>

#include<iostream>

using namespace std;

int main(){

float a[200][200];

float b[200];

int j,h;

float in,mu;

cout<<"GUTIERREZ MENDOZA JHONATAN HENRY"<<endl<<endl;

cout<<"CRITERIO DE ROUTH"<<endl<<endl;

cout<<"ETN 506"<<endl<<endl;

cout<<"*****************************************************"<<endl<<endl<<endl;

cout<<"INTRODUSCA EL GRADO DE LA ECUACION (DENOMINADOR):";

cin>>j;

system("cls");//borrado de pantalla//

cout<<"Digite los coeficientes de la ecuacion: "<<endl<<endl;

cout<<"*****************************************************"<<endl<<endl<<endl;

for(int i=0;i<j+1;i++){

cout<<"Coeficiente de [""s^"<<i<<"]: ";

cin>>b[i];

cout<<"*****************************************************"<<endl<<endl;

system("cls");

if (j==0){

cout<<b[0];
}

else if (j%2==0){

h=(j+2)/2;

for(int k=0;k<2;k++){

for(int i=0;i<h-k;i++){

a[k][i]=b[j-2*i-k];

a[1][h-1]=b[j-2*i-k]-b[j-2*i-k];

}}

for(int k=2;k<j+1;k++){

for(int i=0;i<h-1;i++){

a[k][h-1]=0;

if(a[k-1][i]==0){

a[k][i]=0;}

else{

a[k][i]=(a[k-2][i+1]*a[k-1][i]-a[k-2][i]*a[k-1][i+1])/(a[k-1][i]);

}}}

in=0;

mu=0;

for(int i=0;i<j+1;i++){

if(a[i][0]>=0){

in=a[i][0];}

else{

mu=a[i][0];

}}

cout<<"****************************************"<<endl<<endl;

if(mu<0){

cout<<" SISTEMA INESTABLE "<<endl<<endl;}


else{

cout<<" SISTEMA ESTABLE "<<endl<<endl;}

cout<<"****************************************"<<endl<<endl<<endl;

for(int k=0;k<2;k++){

cout<<"R["<<j-k<<"] [ ";

for(int i=0;i<h;i++){

cout<<a[k][i]<<" ";

cout.precision(3);}

cout<<"]";

cout<<endl;}

for(int k=2;k<j+1;k++){

cout<<"R["<<j-k<<"] [ ";

for(int i=0;i<h;i++){

cout<<a[k][i]<<" ";

cout.precision(3);}

cout<<"]";

cout<<endl;

}}

else{

h=(j+1)/2;

for(int k=0;k<2;k++){

for(int i=0;i<h;i++){

a[k][i]=b[j-2*i-k];

}}

for(int k=2;k<j+1;k++){

for(int i=0;i<h-1;i++){

a[k][h-1]=0;

if(a[k-1][i]==0){
a[k][i]=0;}

else{

a[k][i]=(a[k-2][i+1]*a[k-1][i]-a[k-2][i]*a[k-1][i+1])/(a[k-1][i]);

}}}

in=0;

mu=0;

for(int i=0;i<j+1;i++){

if(a[i][0]>=0){

in=a[i][0];

else{

mu=a[i][0];

}}

cout<<"********************************************"<<endl<<endl;

if(mu<0){

cout<<" SISTEMA INESTABLE "<<endl<<endl;}

else{

cout<<" SISTEMA ESTABLE "<<endl<<endl;}

cout<<"********************************************"<<endl<<endl<<endl;

for(int k=0;k<2;k++){

cout<<"R["<<j-k<<"] [ ";

for(int i=0;i<h;i++){

cout<<a[k][i]<<" ";

cout.precision(3);

cout<<"]";

cout<<endl;

}
for(int k=2;k<j+1;k++){

cout<<"R["<<j-k<<"] [ ";

for(int i=0;i<h;i++){

cout<<a[k][i]<<" ";

cout.precision(3);}

cout<<"]";

cout<<endl;

}}

getch();

return 0;

PRUEBAS ECHAS CON EL PROGRAMA.-

PRUEBA 1.-
PRUEBA 2.-
PRUEBA 3

You might also like