Created
August 25, 2017 22:36
-
-
Save LightningStalker/6cfb52a7be52d28e50d1d0a70d5312d9 to your computer and use it in GitHub Desktop.
LC Tank resonance frequency calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Compile with gcc -Wall -o tankfreq tankfreq.c -lm */ | |
| #include <math.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int main (int argc, char **argv) | |
| { | |
| if (argc == 3) | |
| { | |
| printf ("%f\n", 1 / (3.14159265359 * 2 * sqrt (atof(argv[1]) / | |
| 1000000 * atof(argv[2]) / 1000000))); | |
| return (0); | |
| } | |
| else | |
| { | |
| puts ("tankfreq is an LC tank resonance frequency calculator."); | |
| puts ("output is frequency in Hz\n"); | |
| puts ("Usage: tankfreq microfarads microhenries"); | |
| puts ("Example: tankfreq 3.3 .86207"); | |
| puts ("Output should be: 94360.861167"); | |
| return (1); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment