8

Click here to load reader

A MATLAB project on LCR circuits

Embed Size (px)

Citation preview

Page 1: A MATLAB project on LCR circuits

SINGLE VARIABLE CALCULUS AND MATRIX ALGEBRA PROJECT

TOPIC:- LCR CIRCUITS

BY- S.V.Rohith-150031000

Page 2: A MATLAB project on LCR circuits

Why should we use MATLAB (Matrix Laboratory)? MATLAB has several advantages over other methods or languages:

1) Its basic data element is the matrix. A simple integer is considered an matrix of one row and one column. Several mathematical operations that work on arrays or matrices are built-in to the Matlab environment. For example, cross-products, dot-products, determinants, inverse matrices.

2) Vectorized operations. Adding two arrays together needs only one command, instead of a for or while loop.

3) The graphical output is optimized for interaction. You can plot your data very easily, and then change colors, sizes, scales, etc, by using the graphical interactive tools.

4) Matlab’s functionality can be greatly expanded by the addition of toolboxes. These are sets of specific functions that provided more specialized functionality. Ex: Excel link allows data to be written in a format recognized by Excel, Statistics Toolbox allows more specialized statistical manipulation of data (Anova, Basic Fits, etc)

There are also disadvantages:

1) It uses a large amount of memory and on slow computers it is very hard to use.

2) It sits “on top” of Windows, getting as much CPU time as Windows allows it to have. This makes real-time applications very complicated.

USING MATLAB:- Matlab in not only a programming language, but a programming environment as well. You can perform operations from the command line, as a sophisticated calculator. Or you can create programs and functions that perform repetitive tasks, just as any other computer language. Try a simple operation now: 2 + 2 <enter> To run a program, type its name: demo <enter>

Page 3: A MATLAB project on LCR circuits

One of the most important features of the MATLAB interface is the help. It is very thorough and you can learn almost anything you need from it. Let’s start doing something interesting with MATLAB (Help Manipulating Matrices) The best way for you to get started with MATLAB is to learn how to handle matrices. You can enter matrices into MATLAB in several different ways:

1. Enter an explicit list of elements. 2. Load matrices from external data files. 3. Generate matrices using built-in functions. 4. Create matrices with your own functions in M-files.

We can also solve differential equations by using matlab. We have many types of differential equations. Our project deals with the solving of such kinds of differential equations using traditional method and also by using matlab. In this project our solution is related to the solving of differential equations which are made up by electric circuits. MatLab is a more convenient way of solving differential Equations because all you have to do is to enter the differential equation and the constant values if any. As I have mentioned earlier that our projects deals with the solving of differential equations involving current circuits, let me discuss in detail about them. The general differential equation of 1st order is as follows:-

+ = ( ℎ )

Page 4: A MATLAB project on LCR circuits

Coming to our project, We know that

1) The current flowing through a circuit is = .

2) The voltage drop across any resistor is V=iR.

3) The voltage drop across any inductor is V=L .

4) The voltage drop across any capacitor is V= .

Now the solution of the differential equation with inductance ’L’ and resistance ’R’ will be like:- iR+ L =E(t). Where E(t) is the applied EMF as a function of time. The equation is rearranged as follows:-

. + = ( ) This is further simplified as :-

+ = ( ) Where R/L is p and some constant is q. The solution is :-

= (( ( ) )

Page 5: A MATLAB project on LCR circuits

i(I.F)= ( . ) ( ) Where the Integrating Factor is . The solution of a homogenous equation is Y = + This is called C.F (complementary function). This is as follows. First we consider the diff.equation’s auxiliary equation which is

+pm+ q=0 We will find the roots of the equation. After finding the roots m1 and m2, If m1 and m2 are real and distinct, The C.F = ( ∗ + ∗ ) Else if m1=m2=m ie; roots are real and equal, The C.F = ( + ) Else if the roots m1&m2 are complex and conjugate The C.F = ( ( + )) The general form of 2nd order differential equation is:-

+ + =0(or) a(x). Where is the damping constant. In this form, we have our LCR circuits as follows:-

. + + 1 = ( ) We know that =

Page 6: A MATLAB project on LCR circuits

So, we get, . + . + = ( ) This is a non homogenous equation. Hence the solution is Y=C.F+P.I. Here P.I is Particular Integral. The solution for the particular integral is of two forms 1) when b(x) is in the form of 2) when b(x) is in the form of sin(ax + b) or cos( ax+ b) For the first case the solution would be:-

∗ e That would be e For the second case, the solution would be :-

1m + pm + q ∗ sin(ax + b) or cos(ax + b)

That would be ∗ sin( + ) cos ( + ) Now I will consider an equation to explain the procedure solving it manually as well as using mat lab. This can also be solved in mat lab by using a specific code for each type .

Page 7: A MATLAB project on LCR circuits

For example I will consider the above sum with which I will explain using mat lab >> syms i t >> dsolve('Di+110*i=480','i(0)=0','t') ans = 48/11 - 48/(11*exp(110*t)) >> ezplot(ans) The graph for the equation is

Now I will consider a second order equation which I will solve both manually as well as using mat lab.

Page 8: A MATLAB project on LCR circuits

The mat lab solution is:- >> syms q t >> dsolve('D2q+10*Dq+250=0','q(0)=1','t') ans = C12 - 25*t - (C12 + 3/2)/exp(10*t) + 5/2 >> x=12 - 25*t - (12 + 3/2)/exp(10*t) + 5/2 x = 29/2 - 27/(2*exp(10*t)) - 25*t >> ezplot(x)