0% found this document useful (0 votes)
13 views

Lab Report 1_Group 8_Fahim 1

Uploaded by

Fahim Faysal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Lab Report 1_Group 8_Fahim 1

Uploaded by

Fahim Faysal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

AMERICAN INTERNATIONAL UNIVERSITY–BANGLADESH (AIUB)

Principle of Communication Lab


Fall 2024-2025

Section: B, Group: 08

LAB REPORT ON

Introduction to MATLAB

Supervised By

DR. SHUVRA MONDAL

Submitted By

Name ID

1. Fahim Faysal 21-45558-3

2. Sanjid Raaz 21-44896-2


Title: Introduction to MATLAB

MATLAB Codes & result:

Command: >> A = [1 2 3; 8 6 4; 3 6 9]
Explanation: This command showing the output in a matrix form.

Command: >> A(1,3) + A(2,1) + A(3,2)

Explanation: By this command addressing an element of a matrix.

Command: >> A(2:3,1:2)


Explanation: The k-th to l-th elements of the m-th to n-th columns can be addressed by
A(k:l,m:n). Here selecting 1st and 2nd elements of 2nd and 3rd rows.

Command: >> A(1,1:2)


Explanation: Here selecting 1st and 2nd elements of the 1st row.

Command: >> A(:,2)


Explanation: Selecting the 2nd element of all rows.
Command: >> x = linspace (0, pi, 101)

Explanation: By this command, showing 101 values from 0 to pi (3.1416) in an interval of


pi/100. [linspace (first value, last value, number of values)

Command: >> v= (10: -2:0)


Explanation: By this command.
Command:>>B= zeros (3,4)

Explanation: By this command MATLAB provides the matrix of zero.

Command:>> C= ones (2,5) *6

Explanation: By this command MATLAB provides the matrix of Ones

Command:>>D= rand (1,5)

Explanation: Matrix of rand


Command:>>E=randn (3,3)
Explanation; matrix of randn

Command:>>A (2, :)=[]

Explanation: By this command we deleted the second row of A

Command: >>a= 0:3

Command: >> c = [1 2 3 4;5 6 7 8;9 10 11 12]


Explanation: It’s a Scalar-Array Mathematics.
Command: >> x = 0: pi/100:2*pi;

>> y = sin(x);

>> plot(x,y)

Explanation: The following commands create the final sinewave.


Command: >> x = 0: pi/100:2*pi;
>> y = sin(x);

>> plot(x,y)

>>x1 = 0:pi/100:2*pi;

>>x2 = 0:pi/100:2*pi

>>y1 = sin(x1);

>> y2 = sin(x1 - 0.25);

>> y3 = sin(x2 - 0.5);

>> plot(x1,y1,x1,y2,x1,y3)
Explanation: The following commands creates three sinewave in three different colour.
Command: x = 0: pi/100:2*pi;

>> y = sin(x);

>> plot(x,y)

>>x1 = 0:pi/100:2*pi;

>>x2 = 0:pi/100:2*pi

>>y1 = sin(x1);

>> y2 = sin(x1 - 0.25);

>> y3 = sin(x2 - 0.5);


>> plot(x1,y1,’r-‘,x1,y2,’g—‘,x1,y3, ‘b:’);

>> xlabel(’Time (sec)’);

>> ylabel(’Amplitude’);

>> title(’y = sin(x)’)

Explanation: Here we got three sinewaves; to differentiate these graphs, we used commands to
create one as straight line, one dotted line and one with --.
Discussion and Conclusion:

In this lab report, we explored the fundamental capabilities of MATLAB as a powerful tool for
numerical computing and data visualization. By engaging with various functions and scripts, we
demonstrated MATLAB's versatility in handling mathematical problems and generating
graphical representations. The exercises emphasized the importance of syntax and command
structure, highlighting how these elements contribute to efficient coding practices. Ultimately,
our findings underscore MATLAB's effectiveness in both academic and professional settings,
providing a robust platform for analysis and problem-solving. Future work may involve deeper
explorations into advanced features, such as toolboxes for specific applications, further
enhancing our computational toolkit.

You might also like