Pages

Visitors

Monday 26 December 2011

[Physics Lab]Time Constant of R-C Circuit

AIM : To observe the charge up and decay of the voltage across a capacitor.
           To measure the time constant of an RC circuit.

APPARATUS: Regulated DC power supply, capacitors & resistors of large value,multimeter,stop clock, CRO,                      
                        circuit breadboard and cable.

INTRO:

RC circuits are used extensively in electronics in blinking lights,setting oscillator frequencies, adjusting delays etc.

A capacitor is a device which can store electrical charge.
A simple parallel plate capacitor consists of two parallel metals plates separated by an insulator like dry air,plastic or ceramic etc.

When we connect a capacitor to a battery, opposite charges are developed on it's plates. this results in a net electric potential which is opposite in direction to that of the battery. now as the capacitor accumilates more and more charge it's said to be charging.as the charge increases the voltage between the two plates also increases which results in a reverse voltage.and when this is exactly equal to the battery voltage, no current flows through the circuit.

now, once the capacitor is charged up, if we disconnect it, some charge still remains on the plates which is discharged when we reconnect it to a bulb which glows as the capacitor gets discharged.

here, the speed with which the discharge takes place is dependent on resistance of the circuit and the capacitance of the capacitor.

this is basic principle involved in measuring the time constant of an R-C circuit.

The value of Time constant is equal to the product of resistance and capacitance

The Circuit diagram is as follows : 


Time constant of a capacitor charging circuit is the time required by the voltage across the capacitor to reach to 63.2% of the supply voltage or the charging current to reach 36.8% of the initial value of charging current.
initially when the switch is off, no current is flowing, when switch is on, the capacitor will begin to charge up and voltage will increase.here the voltage is built up across the resistor by ohms law, V = IR

as the charge on the capacitor increases, the current will decrease after reaching a maximum with a certain time constant T.

The voltage across the capacitor is given by the equation

Vc (t) = Vo[1-exp(-t/RC)]

VR(t) = Voexp(-t/RC) or I = (V/R)exp(-t/RC)

But Vo = Vc + Vr
Also,

Vc(t=RC) = Vo[1-exp(-1)]
Vc = 0.63Vo

similarly for charge is given, and then since q = it, we calculate the total current by differentiating Q wrt t

at t= RC, we have i = 0.3681Im

S.No
Time in seconds (t)
voltage across capacitor using multimeter(Vc)
charging
discharging



















Result:

charging T = 

Discharging T=

How to Download and Set-up Code::Blocks

Code::Blocks is a C/C++ compiler:


follow these simple steps to download,install and run code::blocks.

Open the Link given below to download The setup file

CODE::BLOCKS

It's a Reasonably Big file so Please be patient and wait till the download completes.

Then simply open the executable file, if any prompt is displayed, just click OK, code::blocks is a trusted a publisher.

Then click Next-->I Agree--->

in type of install select full from the drop down menu.

chose a suitable location to install Code::blocks

Wait for the installation to complete.

Then open the Code::blocks shortcut on your desktop

go to file menu, select new option and select file.. option from the sub menu.










Then choose c/c++ source file from the pop up window that opens. then Start coding.

you will find out how useful it is once you start coding :p.

Good luck

Distance Calculator : Choose Time interval


To WAP To calculate the Displacement of a particle at a time t in time intervals input by the user along with initial velocity and acceleration.


CODE:

#include <stdio.h>

void main()

{
     float s,u,t,a,n,max;

     printf("Enter values of u and a and max time: ");

     scanf("%f%f%f",&u,&a,&max);

     printf("enter interval : \n");

     scanf("%f",&n);


     printf("\nTime          Distance\n");

     for(t=0;t<=max;t=t+n)

     {
        s = u*t+0.5*a*t*t;

        printf("%5.2f        %7.2f\n",t,s);
     }

     getch();
}

Sunday 25 December 2011

Flow charts

Matrix Addition


Max and Min

Primes

Switch

Smallest and Largest in an array of numbers


#include <stdio.h>

void main()

{
    int a[10],n,i,min=99999,max=-99999;

    printf("enter n: ");

    scanf("%d",&n);

    printf("Enter n elements : ");

    for (i=0;i<n;i++)

    scanf("%d",&a[i]);

    for(i=0;i<n;i++)
    {
        if(a[i]<min)

        min = a[i];
    }

    for(i=0;i<n;i++)

    {
        if(a[i]>max)

        max = a[i];
    }

    printf("smallest value is %d and largest value is %d.",min,max);

    getch();


}

Prime numbers! :D


#include<stdio.h>
#include<conio.h>

void main()
{
    int num,i,j,temp;

    printf("enter range : ");

    scanf("%d",&num);

    printf("The Prime numbers between 1 and %d are : \n",num);

    printf("1\n");

    for (i=2;i<=num;i++)

    {
        temp = i;

        for (j=2;j<=temp;j++)

        {
            if(temp%j==0)

            break;

        }

        if(temp==j)

        printf("%d\n",temp);
    }

    getch();

    }

Friday 23 December 2011

Matrix Multiplication by Arrays


#include<stdio.h>
#include<conio.h>

void main()
{
   int a[30][30],b[30][30],c[30][30],i,j,m,n,p,q,k;

   printf("Enter the rows and columns of matrix A : ");

   scanf("%d%d",&m,&n);

   printf("\nEnter the rows and columns of matrix b : \n");

   scanf("%d%d",&p,&q);

   if(n==p)

   {
       printf("The matrices can be multiplied.");
       printf("\nEnter elements of A:\n");
       for (i=0;i<m;i++)
       for(j=0;j<n;j++)
       scanf("%d",&a[i][j]);

       printf("\n Enter elements of B: \n");
       for (i=0;i<p;i++)
       for(j=0;j<q;j++)
       scanf("%d",&b[i][j]);

       printf("The product of A and B is: \n");

       for(i=0;i<m;i++)
       for(j=0;j<q;j++)

       {
           c[i][j]=0;
           for (k=0;k<n;k++)
           c[i][j] = c[i][j]+a[i][k]*b[k][j];

           printf("%d\n",c[i][j]);

       }

   }

   getch();
}

Thursday 22 December 2011

Fibonacci By Arrays


#include<stdio.h>

void main()
{
   int i,n,a[50];

   printf("enter length of the series : ");
   scanf("%d",&n);

   a[0] = 0;
   a[1] = 1;

   printf("Fibonacci Series : \n");

   printf("\n0\n1");

   for (i = 2; i<n; i++)

   {
     a[i] = a[i-1]+a[i-2];

     printf("\n%d\n",a[i]);
   }


   getch();

   }

Calculator by Switch statement


#include<stdio.h>


main()
{
   int n,a,b,c;


   printf(" enter values of two operands : ");


   scanf("%d%d",&a,&b);


   printf("Chose Operation \n1.Addition\n2.subtraction\n3.multiplication\n4.division\n");


          scanf("%d",&n);


          switch(n)


          {
              case 1 : c = a+b;
              printf("a+b is %d",c);
              break;


              case 2: c = a-b;
              printf("a-b is %d",c);
              break;


              case 3 : c = a*b;
              printf("a*b is %d",c);
              break;
              case 4:c = a/b;
              printf("a/b is %d",c);
              break;


              default : printf("wrong option");
          }


   getch();
}

Roots of a QE


Roots of a Quadratic Equation :

#include <stdio.h>
#include <conio.h>
#include <math.h>

void main()

{
    float disc,x1,x2; int a,b,c;

    printf ("enter a,b,c for ax^2+bx+c = 0: ");

    scanf ("%d%d%d", &a,&b,&c);

    disc = (b*b) - 4*a*c;

    x1 = (-b + sqrt(disc))/2*a;
    x2 = (-b - sqrt(disc))/2*a;

    if (disc >=0 )
    printf("roots are %f,%f.",x1,x2);

    else
    printf ("\nroots are imaginary");
      getch();
}

1- x^2/2! +x^3/3!-.....


To Calculate The sum : 1- x^2/2! +x^3/3!-.....
#include <stdio.h>
#include <conio.h>
#include <math.h>

void main()

{
    float sum; int x;

    printf ("Please input x : ");

    scanf ("%d", &x);

    sum = 1- pow(x,2)/1*2 + pow(x,4)/6*4 - pow(x,6)/24*30 + pow (x,8)/24*30*56 - pow (x,10)/24*30*56*90;


    printf ("\nsum is %f",sum);
      getch();
}

Wednesday 14 December 2011

Transpose Of a Matrix[CP LAB]

Transpose Of a Matrix



#include<stdio.h>

void main()
{
    int a[10][10],b[10][10],i,j,m,n;

    printf(" Enter row and column of Matrix A : \n");

    scanf("%d%d",&m,&n);

   printf ("Input elements of Matrix A: \n");

         for ( i=0; i<m;i++)

         for (j=0;j<n;j++)

         scanf("%d", &a[i][j]);

         for (i=0;i<m;i++)

         for (j=0;j<n;j++)

         b[i][j] = a[j][i];

         printf("The transpose of A is: \n");

         for (i =0; i<m;i++)
        {
              for (j=0;j<n;j++)

              printf("%5d",b[i][j]);
        }
    getch();
}







To Add Two matrices Using Arrays[CP LAB]

To Add Two matrices Using Arrays 



#include<stdio.h>




void main()
{


    int a[10][10],b[10][10],c[10][10],i,j,m,n,p,q;


    printf(" Enter row and column of Matrix A : \n");


    scanf("%d%d",&m,&n);


    printf("\n enter row and column of Matrix B: \n");


    scanf("%d%d",&p,&q);


    if ( m==p && n==q)


    {
         printf ("The Two matrices can be added.\n Enter the elements of A>>");


         for ( i=0; i<m;i++)


         for (j=0;j<n;j++)


         scanf("%d", &a[i][j]);


         printf ("Enter The Elements of matrix B:\n");


         for (i=0;i<p;i++)


         for (j=0;j<q;j++)


         scanf("%d",&b[i][j]);


         for (i=0;i<m;i++)


         for (j=0;j<n;j++)


         c[i][j]=a[i][j]+b[i][j];


         printf (" A + B = \n");


         for (i =0; i<m;i++)


         {
              for (j=0;j<n;j++)


              printf("%5d\n",c[i][j]);


         }
    }
    else printf(" Matrices cannot be added.");


    getch();


         }

Saturday 10 December 2011

To Check if a Number is even or Odd

#include <stdio.h>

void main()

{

int a;

printf(" Please enter the number to check : ");

scanf("%d",&a);

if(a%2 == 0;)

printf("\nThe Number %d is Even.",a);

else
printf("The number %d is odd.",a);

getch();

}

Wednesday 7 December 2011

[CP LAB]

program 1

#include <stdio.h>
#include <conio.h>
#include <math.h>

void main()

{
    int fib[15];
    
    int i;
    
    fib[o] = 0;
    
    fib[1] = 1;
    
    for (i = 2; i < 15;i++)
    
    fib[i] = fib[i-1]+ fib[i-2];    
    for (i=0; i<15; i++)
    
    printf ("%d\n", fib[i]);
    
    
}



Program 2

#include <stdio.h>
#include <conio.h>
#include <math.h>

void main()

{
    int a[30],i,n,key,found = 0;

    printf("\n how many numbers");

    scanf("%d", &n);


    if (n >30)

    {
        printf("\n too many numbers");

    }

    printf("\n enter array elements one by one \n");


    for (i =0; i <n; i++)

    scanf("%d", &a[i]);

    printf ("\n enter the key to be searched \n");

    scanf ("%d", &key);

    for (i=0; i <n ;i++)

    if (a[i] == key)

    {
        printf ("\n Found at %d", i);

        found = 1;
    }


    if ( found == 0)

    {
        printf("\n not found");
    }
    getch();
}

Tuesday 6 December 2011

[Assignment]6th december

Hey everyone,

Just got an information right now from the other CR That everyone has to submit Their IT workshop lab notes by tomorrow, you have to write about Topics listed below

SOURCE : syllabus book jntu ( The thin one ) :p

Go to page 49 

Week 11 : task 1: Latex and word:

formatting fonts, applying text effects, using character spacing, borders and colors, inserting headers and footers, using date and time option in word.

in formatting fonts, we have to write how the font size and style can be changed in word and have to show a preview in a text box, like a big text for size 20 and smaller for size 10

rest other options are easily understandable and can be written about easily.


Week 12 : task 2: Creating project.

formatting styles, inserting tables, bullets and numbering, changing text direction, cell alignment, footnote, hyperlink, symbols, spell check , track changes

all these are easily google-able and Please do complete these else you will be given a lame 0 by that sick teacher.

Here's a link to the IT workshop lab manual



it has all descriptions incase you'd like to refer too.

PS: will be making a new website dedicated for this shit CR job soon so keep hooked on


Regards : SAI-