Matlab Code for LC circuit for FM radio | applied electronics engineering

# Matlab Code for LC circuit for FM radio

By Applied Electronics - Friday, February 3, 2017 No Comments
Matlab code for LC circuit for FM radio is given below. This program calculates the FM radio frequency for given capacitor and inductor. An example of calculation for given inductor and capacitor is shown. The example is for the FM bug transmitter.

The inductor formula that is used is given as under. This is for practical inductor.

Note that the inductor value calculated will be in micro Henry or uH. Also the diameter of the inductor core(d) and the length(l) is in inches unit(not millimeter). n is the number of turns.

The following figure shows the dimensions:

#### Example Calculation

For the FM bug transmitter of the previous post, we can use the above formula to calculate the frequency of the LC oscillator for give wire diameter, length and number of turns. The matlab code is below.

clear all
close all
clc

C = input('Enter the capacitance(uF): ');
if isempty(C)
C = 4.7e-5;%0.000047; %47pF or 0.000047uF
end

d = input('core diameter(mm): ');
if isempty(d)
d = 3;
end

D = input('wire diameter(mm): ');
if isempty(D)
D = 0.5;
end

n = input('number of turns: ');
if isempty(n)
n = 5;
end

Dinch = 0.0393701*D;
dinch = 0.0393701*d;
linch = n*Dinch;  %compact core

deff = dinch+Dinch;

%calculate inductance

LuH = (deff^2*n^2)/(18*deff+40*linch);

%calculate frequency

fcmhz = 1/(2*3.14*sqrt(LuH*C));

disp('---------------------------------');
disp(['Resonant Freqn.: ', num2str(fcmhz),' MHz']);


In the above code, we have used default values, values for the FM bug transmitter. The capacitance is 47pF, the number of turns, the wire diameter(D), the inductor diameter(d) are 5, 0.5mm and 3mm.

Just press enter if you don't have values, the program will use the default values. For example, the calculate frequency for default value is 85.4012 MHz. This is shown below.