its a good book to get an idea about simulation............to download this book CLICK HERE
mymatlabdaily
Tuesday, February 15, 2011
Simulation.Modeling.and.Analysis.-.Third.Edition.-.Averill.M.Law.-.W.David.Kelton
Tuesday, November 16, 2010
MATLAB-7(FUNCTION SIZE)
in this article i want to discuss the function size.
size function returns the size of the array.
observe the following code:
x=[1 2 3 4];
[m,n]=size(x);
disp(m);
disp(n);
the output of the above code is 1,4
here the size function gets the size of the array as 1*4 and it stores 1 in 'm' and 4 in 'n'.
size function returns the size of the array.
observe the following code:
x=[1 2 3 4];
[m,n]=size(x);
disp(m);
disp(n);
the output of the above code is 1,4
here the size function gets the size of the array as 1*4 and it stores 1 in 'm' and 4 in 'n'.
Monday, November 15, 2010
MATLAB-6(FUNCTION FIND)
in this article i want to discuss the function 'find':
find returns the indices of an array elements which have non zero value
just see the following array:
[1 2 0 0 3]
in this the first,second,fifth elements have non zero value so the find function returns 1,2,5.
observe the following code:
x=[1 2 0 0 3];
y=find(x);
disp(y);
this code gives the output 1,2,5.
and observe the following code:
x=[1 2 0 0 3];
[y,z]=find(x);
disp(y);
disp(z);
this code gives the output as
1 1 1
1 2 5
[y,z]=find(x);
in this line find function gets the rows and columns numbers of the non zero elements of the array x.
observe the following code:
x=[1 2 0 0 3];
[y,z,v]=find(x);
disp(y);
disp(z);
disp(v);
in the above code
[y,z,v]=find(x);
gets the rows and columns numbers of the non zero elements of the array x and v contains the non zero array of x i.e here v contains 1 2 3.
so the output of the above code is
1 1 1
1 2 5
1 2 3
we can run the above code in the command window also with or with out using disp.
thats it!
find returns the indices of an array elements which have non zero value
just see the following array:
[1 2 0 0 3]
in this the first,second,fifth elements have non zero value so the find function returns 1,2,5.
observe the following code:
x=[1 2 0 0 3];
y=find(x);
disp(y);
this code gives the output 1,2,5.
and observe the following code:
x=[1 2 0 0 3];
[y,z]=find(x);
disp(y);
disp(z);
this code gives the output as
1 1 1
1 2 5
[y,z]=find(x);
in this line find function gets the rows and columns numbers of the non zero elements of the array x.
observe the following code:
x=[1 2 0 0 3];
[y,z,v]=find(x);
disp(y);
disp(z);
disp(v);
in the above code
[y,z,v]=find(x);
gets the rows and columns numbers of the non zero elements of the array x and v contains the non zero array of x i.e here v contains 1 2 3.
so the output of the above code is
1 1 1
1 2 5
1 2 3
we can run the above code in the command window also with or with out using disp.
thats it!
MATLAB-5(POLAR PLOTS )
yesterday i had studied radiation patterns of antennas and bhargav ! one of my friends just wants me to plot the radiation patterns in matlab...........and i can finally plot the radiation patterns.
to plot cos(pi/2 cos(theta).........i had written the following code:
theta=0:pi/40:2*pi
en=cos(pi/2.*cos(theta));
polar(theta,abs(en));
and i got the output as shown bellow:
in the above code plot function will not give correct result as it can plot linear graphs only.and here i got this plot only because of the function 'polar'.but the disadvantage is it cant plot negetive values.so to eliminate that one we should use the function 'abs'.
obseve the following code once:
theta=0:pi/40:2*pi;
en=cos(pi.*cos(theta));
polar(theta,abs(en));
this code is for cos(pi cos(theta))
and the output that i got is as shown above:
theta=0:pi/40:2*pi
en=cos(pi/2.*cos(theta)).*cos(pi.*cos(theta));
polar(theta,abs(en));
the output of the above code is as shown bellow:
Friday, November 12, 2010
MATLAB-4(LEGEND,HOLD ON)
in this article i want to discuss the following things.
1.legend
2.hold on
the function legend is used to describe the various graphs with some identification so that any one can understand what each graph is ment for.
observe the following code:
x=0:1:10;
y1=x.^2;
y2=x.^3;
plot(x,y1,x,y2);
legend('y=x^2','y=x^3');
observe the result of this code:
from the above graph we can observe that because of the legend function we r getting y=x^2 and y=x^3 on the top of the graph with colors.................
now lets discuss about 'hold on':
hold on fixes all the properties of axes remain so that we can plot the graphs in one window.observe the following code:
x=0:.1:10;
y1=x.^2;
y2=x.^3;
y=x;
plot(x,y1);
hold on;
plot(x,y2);
plot(x,y);
the result of this graph is;
from the above graph we can say that all the graphs are present in a single window..............and this is possible only because of the 'hold on'.thats it..................
1.legend
2.hold on
the function legend is used to describe the various graphs with some identification so that any one can understand what each graph is ment for.
observe the following code:
x=0:1:10;
y1=x.^2;
y2=x.^3;
plot(x,y1,x,y2);
legend('y=x^2','y=x^3');
observe the result of this code:
from the above graph we can observe that because of the legend function we r getting y=x^2 and y=x^3 on the top of the graph with colors.................
now lets discuss about 'hold on':
hold on fixes all the properties of axes remain so that we can plot the graphs in one window.observe the following code:
x=0:.1:10;
y1=x.^2;
y2=x.^3;
y=x;
plot(x,y1);
hold on;
plot(x,y2);
plot(x,y);
the result of this graph is;
from the above graph we can say that all the graphs are present in a single window..............and this is possible only because of the 'hold on'.thats it..................
Thursday, November 11, 2010
MATLAB-3
in this article i want to discuss about
1.plot
2.subplot
3.semilogy
4.clc
plot is a function that is used to plot graphs in matlab
x=1:10;
y=x.^2;
plot(x,y);
the above code gives y=x^2 graph........and we will discuss where to use the dot and where not to use the dot in another article.
and observe the following code for the discussion of subplot:
x=1:10;
y1=x.^2;
y2=x;
subplot(2,1,1);plot(x,y1);
subplot(2,1,2);plot(x,y2);
here the code 2,1,1 specifies that there are 2*1 number of figures(2 rows and 1 colomn)(first and second numbers of 2,1,1) among them the first figure(which is indicated by the third number) should be the first one.
observe that 2,1,2 specifies (the third number) it is the second figure among the 2*1 figures.the output for the above code is as shown bellow:
thats it......................
and lets discuss about semilogy:
semilogy(x,y);plots the y vs x graph..........but it takes y in db i.e log base 10 values and x on a linear scale.similarly semilogx plots the y vs x graph taking x values to log base 10.
observe the following code:
x =1:1:100;
semilogy(x,x);
and the output is as shown bellow:
now we can observe that the y is plotted as in db.........but it is shown with normal scale only.........however the values r taken by log scale.
now lets discuss about clc;
clc operation is nothing but Clear Command Window thats it.............
1.plot
2.subplot
3.semilogy
4.clc
plot is a function that is used to plot graphs in matlab
x=1:10;
y=x.^2;
plot(x,y);
the above code gives y=x^2 graph........and we will discuss where to use the dot and where not to use the dot in another article.
and observe the following code for the discussion of subplot:
x=1:10;
y1=x.^2;
y2=x;
subplot(2,1,1);plot(x,y1);
subplot(2,1,2);plot(x,y2);
here the code 2,1,1 specifies that there are 2*1 number of figures(2 rows and 1 colomn)(first and second numbers of 2,1,1) among them the first figure(which is indicated by the third number) should be the first one.
observe that 2,1,2 specifies (the third number) it is the second figure among the 2*1 figures.the output for the above code is as shown bellow:
thats it......................
and lets discuss about semilogy:
semilogy(x,y);plots the y vs x graph..........but it takes y in db i.e log base 10 values and x on a linear scale.similarly semilogx plots the y vs x graph taking x values to log base 10.
observe the following code:
x =1:1:100;
semilogy(x,x);
and the output is as shown bellow:
now we can observe that the y is plotted as in db.........but it is shown with normal scale only.........however the values r taken by log scale.
now lets discuss about clc;
clc operation is nothing but Clear Command Window thats it.............
Wednesday, November 10, 2010
CONTEMPORARY COMMUNICATIONS USING MATLAB BOOK DOWNLOAD
this helps to learn matlab in a good way.............download this book for better matlab performance..............to download this book CLICK HERE
Subscribe to:
Posts (Atom)