Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Visual studio C++ Thank u Problem Statement: components needed for a given cutof

ID: 3770732 • Letter: V

Question

Visual studio C++ Thank u Problem Statement: components needed for a given cutoff You are to create a program that can be used to find the (f) and frequency for a Sallen-Key Low Pass filter A user will enter the values for the cutoff frequency (o to user will then have the options of having a table created showing the frequency response user's decision) or entering another fe and C1 exiting. The Sallen-Key Low Pass Filter Circuit (Unity Gain) is modeled below: Min O Win WW C1 The needed equations for the components are (given C1 and fe): 4.0 atan(1.0) Q 0.7071 C2 C1 2 R1 R2 The equation to use for the frequency response (gain) table: G An example of the first input screen: visual studio 2010WProjectslFinal.Part.BADebug Final Part B exe nicrof arads lease enter the value for Please enter the cutoff frequency, fc. in Hz: 10000 Farads value for C1 is: B.01A nicro B. R120 microfarads for i value R1 and R2 is: 1125.395 ohns The value for 100B0.000 Hertz he cutoff frequency, fc is any key to continue Press An example of a simple menu visual studio 2010WProjectslFinal.Part BMDebugWFinal.Part.B.exe lease choose front Enter in neu values for R and Create the freq response table when fc 10000.000 exit the program. Using a table, show the frequency response between 0 and a value the user decides in 1kHz increments. Your output should be similar to:

Explanation / Answer

// MicorFarade.cpp : main project file.

#include "stdafx.h"

#include <cmath>

using namespace System;

int main(array<System::String ^> ^args)
{
   //hard code value for Q
  
   double Q = 0.7071, C1= 0, C2 = 0, Fc = 0, R = 0;
   double sqrt2 = sqrt(2.0);
   double PI = 22.0/7.0;
      Console::WriteLine(L"Please enter the value for C1 in microfaradas:");
      C1 = Double::Parse(Console::ReadLine());
   Console::WriteLine(L"Please enter the cutoff frequencey, in Hz: ");
      Fc = Double::Parse(Console::ReadLine());

   //calculate and display
      C2 = C1 * 2;
  
       R = 1/ (2 * sqrt2 * PI * C1 * Fc);

      Console::WriteLine(L"The value for C1 is: "+C1+" microfards");
       Console::WriteLine(L"The value for C2 is: "+C2+" microfards");
        Console::WriteLine(L"The value for R1 and R2 is: "+R+" ohms");
       Console::WriteLine(L"The cutoff frequencey is: "+Fc+" Hertz");

       int option = 1;
       while(option != 3) {
           Console::WriteLine(L"Please choose from the following options");
           Console::WriteLine(L"1 - Enter in new values for R and C");
          Console::WriteLine(L"2 - Create the freq response table when fc = 10000.000");
           Console::WriteLine(L"3 - exit the prgoram");
           Console::WriteLine("Enter your option: ");
           option = Int32::Parse(Console::ReadLine());
           if(option == 1) {
                Console::WriteLine(L"Please enter the value for C1 in microfaradas:");
               C1 = Double::Parse(Console::ReadLine());
               Console::WriteLine(L"Please enter the value for R in ohms:");
               R = Double::Parse(Console::ReadLine());
           } else if(option == 2) {
               Console::WriteLine(L"What freq wouuld you like to stop (needs to be positive) ?:");
               double freq = Double::Parse(Console::ReadLine());
                Console::WriteLine("Frequenceyy(Hz)             Vout/Vin");
               Console::WriteLine("------------------------------------");
               double f = 0;
               double G = 0;
               while(f <= freq) {
                   G = 1/ sqrt(pow((1- pow(f/Fc, 2)),2 )+((1/pow(Q,2)) * (pow(f/Fc,2))));
                   Console::WriteLine(f+"                         "+G);
                   f += 1000;
               }
           } else if(option == 3) {
               break;
           } else {
               Console::WriteLine(L"Invalid option");
           }
       }
   Console::ReadKey();
    return 0;
}

--output--

Please enter the value for C1 in microfaradas:
.01
Please enter the cutoff frequencey, in Hz:
10000
The value for C1 is: 0.01 microfards
The value for C2 is: 0.02 microfards
The value for R1 and R2 is: 0.00112494260643314 ohms
The cutoff frequencey is: 10000 Hertz
Please choose from the following options
1 - Enter in new values for R and C
2 - Create the freq response table when fc = 10000.000
3 - exit the prgoram
Enter your option:
2
What freq wouuld you like to stop (needs to be positive) ?:
25000
Frequenceyy(Hz)             Vout/Vin
------------------------------------
0                         1
1000                         0.999949811974831
2000                         0.999200193345593
3000                         0.995972733377862
4000                         0.987437677253746
5000                         0.970138121894959
6000                         0.940881660536892
7000                         0.897983496030881
8000                         0.842264065876361
9000                         0.777056588842108
10000                         0.7071
11000                         0.637040062392707
12000                         0.570390683920853
13000                         0.509239643396122
14000                         0.45446681290785
15000                         0.406135574992907
16000                         0.363848161974141
17000                         0.326996312267714
18000                         0.294913093624608
19000                         0.266954054599092
20000                         0.24253453047374
21000                         0.221142249663287
22000                         0.202337196854685
23000                         0.185745615020007
24000                         0.171051865432449
25000                         0.157990028360599
Please choose from the following options
1 - Enter in new values for R and C
2 - Create the freq response table when fc = 10000.000
3 - exit the prgoram
Enter your option: