You are on page 1of 23

THEJUS ENGINEERING COLLEGE

VELLARAKKAD

LAB MANUAL

07 CE 6307 COMPUTATIONAL LAB

M.TECH STRUCTURAL ENGINEERING

FIRST SEMESTER
1. INTRODUCTION TO MATLAB -BASIC MATRIX OPERATIONS

AIM

To Study the basic matrix operations using MATLAB

INPUT & OUTPUT

>> a=[1 2 3;4 5 6;7 8 9]

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)

ans = 0.8415 0.9093 0.1411

-0.7568 -0.9589 -0.2794

0.6570 0.9894 0.4121

>> 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

To plot trigonometric functions using MATLAB

INPUT & OUTPUT

>> %plot of sinx

>> 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')

>> %plot of cos(x)and sin(x)in single graph


>> x=(-2*pi:pi/8:2*pi);
>> y=sin(x);
>> z=cos(x);
>> plot(x,y,'r')
>> grid on
>> hold on
>> plot(x,z)
>> title('plot of sinxcosx')
>> xlabel('x')
>> ylabel('sinx and cos x')
3. DETERMINATION OF DIFFERENTIATION AND INTEGRATION

AIM

To find the derivative and integral using MATLAB and compare the results with the exact value.

INPUT & OUTPUT

% Find the derivative of the polynomial f(x)=2x2+5x+3 at x=10

>> f=[2 5 3]
>> g=polyder(f)
>> h=polyval(g,10)

f=

2 5 3

g=

4 5

h=

45

%Find integral of function f(x)= 2x2+5x+3 in the range x=10 to 20

>> f=[2 5 3]
>> p=polyint(f)
>> q=polyval(p,20)-polyval(p,10)

p=

0.6667 2.5000 3.0000 0

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 & OUTPUT

%plot for a=0.001 and w=3 , values of t ranging from 0 to 5000

%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

%To start with LATEX


\documentclass{article}
\begin{document}
Report!
\end{document}

%to mention author and date


\documentclass{article}
\title{Simple Example}
\author{aswathy}
%\author{Jane Doe \and John Doe}
\date{April 2018}
\begin{document}
\maketitle
The Submerged Floating Tunnel is an innovative concept for crossing waterways which utilizes the law
of buoyancy to support the structure at a moderate and convenient depth. It is a tube like structure made
up of steel and concrete.
\end{document}

%to include table of contents,list of figures,tables etc


\documentclass[a4paper, 12 pt, oneside]{book}
\usepackage{graphicx, amsmath}
\title{Simple Example}
\author{Aswathy}
\date{\today}
\begin{document}
\maketitle
\tableofcontents
\listoftables
\listoffigures
\chapter{Introduction}
Hii All this is Introduction to \LaTeX\ Class
\section{First heading of the section}
Datas in the First Section.
\subsection{First heading in the second section}
Datas in the First Section.
\end{document}
%to use bullets
\begin{itemize}
\item Mango
\item Banana
\end{itemize}

%to use bullets and subsections


\begin{itemize}
\item Apple
\begin{itemize}
\item Red
\item Green
\end{itemize}
\item Orange
\end{itemize}

%to use numbering


\begin{enumerate}
\item Apple
\item Orange
\end{enumerate}

%to align the paragraphs


\begin{flushright}
Right aligned
\end{flushright}
\begin{center}
Center aligned
\end{center}

\begin{flushleft}
Left aligned
\end{flushleft}

%for tabular representaion


\begin{table}[h]
\begin{center}
\begin{tabular}{|l|r|c|}
\hline
Date & Price & Size \\ \hline
Yesterday & 5 & big \\ \hline
Today & 3 & small \\
\hline
\end{tabular}
\caption{TabNam}
\end{center}
\end{table}

%for inserting figures

\begin{figure}[h]

\begin{center}

\includegraphics{6.JPG}

\caption{\bf Vicat apparatus}

\end{center}

\end{figure}

%for inserting equations


\begin{equation}
$$
ax+by+c = 0
$$
\end{flushleft}

%for inserting equations in paragraphs without equation number


$
x^n+y^n=z^n
$
%for inserting root
$
2\sqrt{2}
$
6. PREPARATION OF TECHNICAL DOCUMENT IN LATEX

AIM
To prepare a report in LATEX .

PROCEDURE

Write a program in LATEX for the preparation of a report.


7. INTRODUCTION TO MAPLE

AIM

To study the basic mathematical commands in MAPLE

INPUT & OUTPUT


8. DETERMINATION OF EIGEN VALUES AND EIGEN VECTORS

AIM

To study the basic matrix operations in MAPLE and find out the eigen values and eigen vectors.

INPUT & OUTPUT


9. DIFFERENTIATION AND INTEGRATION USING MAPLE

AIM

To find the differential and integral of the functions using MAPLE .

INPUT & OUTPUT


10. SOLUTION OF ALGEBRAIC & DIFFERENTIAL EQUATIONS

AIM

To find the solution of algebraic and differential equations using MAPLE .

INPUT & OUTPUT


11. LAPLACE TRANSFORM AND INVERSE LAPLACE

AIM

To find the laplace transform and inverse laplace using MAPLE .

INPUT & OUTPUT

You might also like