Blogger news

Saturday, 12 July 2014

Ploting in MATLAB

Three-dimensional plots typically display a surface defined by a function
in two variables, z = f (x,y).
To evaluate z, first create a set of (x,y) points over the domain of the function
using meshgrid.
[X,Y] = meshgrid(-2:.2:2);
Z = X .* exp(-X.^2 - Y.^2);
Then, create a surface plot.
surf(X,Y,Z)




for sub plot:
Subplots
You can display multiple plots in different subregions of the same window
using the subplot function.
For example, create four plots in a 2-by-2 grid within a figure window.
t = 0:pi/10:2*pi;
[X,Y,Z] = cylinder(4*cos(t));
subplot(2,2,1); mesh(X); title('X');
subplot(2,2,2); mesh(Y); title('Y');
subplot(2,2,3); mesh(Z); title('Z');
subplot(2,2,4); mesh(X,Y,Z); title('X,Y,Z');

Some Matrix MATLAB functions

size    size of a matrix
det     determinant of a square matrix
inv       inverse of a matrix
rank      rank of a matrix
rref       reduced row echelon form
eig            eigenvalues and eigenvectors
poly        characteristic polynomial
norm       norm of matrix (1-norm, 2-norm, ∞ -norm)
cond       condition number in the 2-norm
lu LU      factorization
qr QR       factorization
chol      Cholesky decomposition
svd       singular value decomposition

Saturday, 5 July 2014

Drawing BD flag using C programming code

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
 main ()
{
int driver,mode,i,j;
clrscr();

driver=DETECT;
  initgraph(&driver,&mode,"c:\\tc\\bgi"); // here you have to change the directory.if you install your software at "D" drive then you have write(&driver,&mode,"d:\\tc\\bgi")

  for(i=0;i<120;i++)
  {
  for(j=0;j<64;j++)
  {
  rectangle(0+j*50,0+i*40,50+j*50,40+i*40);
  }
  }
  setcolor(6);
  setbkcolor(2);
  setfillstyle(1,6);
  for(i=0;i<120;i++)
  {
  for(j=0;j<64;j++)
  {
  circle(25+j*50,20+i*40,10);
  floodfill(25+j*50,20+i*40,6);
  }
  }

getch();
}

Friday, 4 July 2014

Designing a Voltage Divider Biasing Circuit



Required Equipments:
                   Voltage Source of 5-10V.
                   Four resistor of 1 K.
                   One resistor of 1.5K.
                   One resistor of 2.2K.
                   One BJT (C828).



Circuit Diagram: