logo

C program code:.

Generate a table of various filter-circuit parameters for a passive low-pass filter based on a second-order configuration using a single inductor and capacitor. Prompt the user for values, perform calculations, display the table on the screen, and save it in a text file.

3 Pages530 Words57 Views
   

Added on  2022-10-12

C program code:.

Generate a table of various filter-circuit parameters for a passive low-pass filter based on a second-order configuration using a single inductor and capacitor. Prompt the user for values, perform calculations, display the table on the screen, and save it in a text file.

   Added on 2022-10-12

ShareRelated Documents
C program code:
#include <stdio.h>
#include <conio.h>
#include <math.h>
#define PI acos(-1.0) // defining value of pi
int main()
{
// Initializing with paramters of low pass filters
float L,C; int i;
float XL[18],XC[18],atten[18],dBatten[18],omega[18];
printf("Enter the value of inductor in mH: ");
scanf("%f",&L);
printf("Enter the value of capacitor in uF: ");
scanf("%f",&C);
float freq[18] =
{100,200,300,400,500,600,700,800,900,1000,2000,3000,4000,5000,6000,7000,8000,9000}; /
/ Initializing frequency array
// Calculation loop
L = L*1e-3;
C= C*1e-6;
for(i=0;i <= 17;i++)
{
omega[i] = 2*PI*freq[i]; // calculating natural frequency
XL[i] = omega[i]*L; XC[i] = 1/(omega[i]*C); // calculating capacitive and inductive
reactance
C program code:._1

End of preview

Want to access all the pages? Upload your documents or become a member.