SNS Lab 1
SNS Lab 1
SNS Lab 1
MATLAB Code:
% Task 1: Create a vector a and b
a = 0:0.1:10;
b = cos(0:0.2:20);
% a. C where Ci = ai/bi.
C = a ./ b
% b. d where di = ai^4
d = a .^ 4
Output
f= 46.0507
Task 02:
MATLAB Code:
% Task 2: Create a 3 × 3 matrix with all its elements randomly distributed
in [0, 1].
A = rand(3);
Output:
Task 03:
MATLAB Code:
% Define the matrix x
x = [1/4, 1/4, 5/4; -1, 2, 1; -5/4, -1/4, 15/4]
Output:
Lab Analysis:
In this lab we study about the how to use Matlab in our engineering field . In
this lab we get introduce to matlab deeply study and use different commands . we come to
know how to create vectors and apply different operations on them and study different
commands and check there results similarly we come to know how to create different
matrices and how to apply different operations on them I.e how to get dot product etc.