Professional Documents
Culture Documents
VELLARAKKAD
LAB MANUAL
FIRST SEMESTER
1. INTRODUCTION TO MATLAB -BASIC MATRIX OPERATIONS
AIM
a= 1 2 3
4 5 6
7 8 9
>> zeros(3,1)
ans = 0
>> a+5
ans = 6 7 8
9 10 11
12 13 14
>> inv(a)
>> a'
ans = 1 4 7
2 5 8
3 6 9
>> p=a.*a
p= 1 4 9
16 25 36
49 64 81
>> p=a.^2
p= 1 4 9
16 25 36
49 64 81
%CONCATENATION:
>> b=[a,a]
b= 1 2 3 1 2 3
4 5 6 4 5 6
7 8 9 7 8 9
>> b=[a;a]
b= 1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
>> c=magic(4)
c=
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
>> c(4,2)
ans = 14
>> c(3,3)
ans = 6
>> c(1:3,3)
ans = 3
10
>> c(2,:)
ans = 5 11 10 8
>> B=0:5:50
B= 0 5 10 15 20 25 30 35 40
45 50
>> S=zeros(3,1)
S=
0
0
0
>> s=ones(3,2)
s=
1 1
1 1
1 1
2. PLOTTING OF TRIGNOMETRIC FUNCTIONS
AIM
>> x=(-2*pi:pi/8:2*pi);
>> y=sin(x);
>> plot(x,y)
>> grid on
>> title('plot')
>> xlabel('x')
>> ylabel('sinx')
>> %plot the graph of cosx
>> x=(-2*pi:pi/8:2*pi);
>> y=cos(x);
>> plot(x,y)
>> grid on
>> title('plot')
>> xlabel('x')
>> ylabel('cosx')
AIM
To find the derivative and integral using MATLAB and compare the results with the exact value.
>> f=[2 5 3]
>> g=polyder(f)
>> h=polyval(g,10)
f=
2 5 3
g=
4 5
h=
45
>> f=[2 5 3]
>> p=polyint(f)
>> q=polyval(p,20)-polyval(p,10)
p=
q=
5.4467e+03
>> f=[4 5 3 2]
4. PLOTTING OF USER DEFINED FUNCTIONS
AIM
Write a program in MATLAB to plot f(t)= e-at sin(wt) , where the values of a and w are provided by the
user.
%input
>>a=input('enter the value of a \n')
>> w=input('enter w')
>> t=0:1:5000;
>> y=exp(-a*t).*sin(w*t);
>> plot(y)
%output
enter the value of a
.001
enter w
2
>> plot(y,'r')
5. INTRODUCTION TO LATEX
AIM
To study the basic commands in LATEX for the preparation of technical report.
INPUT
\begin{flushleft}
Left aligned
\end{flushleft}
\begin{figure}[h]
\begin{center}
\includegraphics{6.JPG}
\end{center}
\end{figure}
AIM
To prepare a report in LATEX .
PROCEDURE
AIM
AIM
To study the basic matrix operations in MAPLE and find out the eigen values and eigen vectors.
AIM
AIM
AIM