nUMERICAL 01
nUMERICAL 01
INTRODUCTION TO MATLAB
TOUKIR AHMED
20108074
4th year 2nd semester
Objectives
The purpose of this experiment is to gain familiarity with MATLAB and build some basic skills
in MATLAB language. The very basics of MATLAB, i.e. writing codes, computing
mathematical calculations, the concept of arrays and matrices, plotting data, creating functions
etc. are described in this experiment.
Theory
MATLAB is a high-performance language for technical computing. The name MATLAB stands
for MATRIX LABORATORY. In Academic environment, it is the standard instructional tool for
introductory and advanced courses in mathematics, engineering and science. There are some basic
character’s descriptions explained in the table below which are commonly using in MATLAB.
Required software and skills
function waveform =
cosgen(freq, duration)
% Calculate the number
of samples needed
num_samples = duration *
freq;
[sum_result, product_result]
= add_multiply_complex(a,
b);
disp(['Sum: ',
num2str(sum_result)]);
disp(['Product: ',
num2str(product_result)]);
Function
function [sum_result,
product_result] =
add_multiply_complex(a, b)
% a and b are complex
numbers
% sum_result is the sum
of a and b
% product_result is the
product of a and b
% Solve for X
X = A \ B;