Matlab Project File
Matlab Project File
Matlab Project File
BACHELOR OF TECHNOLOGY IN
ELECTRONICS & COMMUNICATION ENGINEERING
Submitted by
HIMANSHU (02316412820)
BTECH ECE 7th SEM
Submitted to
Mr Manvendra Singh
(Research Scholar, USICT )
INDEX
SNo. Experiment
3 Write MATLAB programs for Arrays to find the smallest number in the array
and sort the array
9 Write a brief introduction about Simulink. Also, create a model and show the
simulation for that model.
10 Write a code to generate and plot a sinusoidal signal with frequency 100 Hz
and amplitude 1 V
It has numerous built-in commands and math functions that help you in mathematical
calculations, generating plots, and performing numerical methods.
Applications of Matlab is built around the Matlab scripting language and revolves based
on the following mathematical concepts:
- Variables
- Vectors and matrices
- Structures
- Functions
- Function handles
- Classes and object-oriented programming
APPLICATIONS
1. Embedded Systems
Embedded systems are computer systems consisting of hardware and software components and
are designed to do a specific task. Some examples of embedded systems are washing machines,
printers, automobiles, cameras, industrial machines, etc. With the push of one button, Matlab
allows us to generate code and run it on hardware.
2. Control Systems
Another most common reason why the use of Matlab is important is that it provides control to
devices and systems. A control system is responsible for managing, giving commands and
regulating the behavior of other devices or systems. It is based on control loops. The devices or
systems being controlled can range from simple home heaters to large industrial control systems
that control the processes or the machines. The control system toolbox of Matlab provides
algorithms and apps for systematically analyzing, designing and tuning linear control systems.
4. Wireless Communication
Wireless communication is a broad term used for connecting two devices using a wireless signal.
Teams in wireless Engineering use Matlab too reduce development time, eliminate design
problems early, and streamline testing and verification.
6. Internet of Things
Internet of Things is the network of devices, vehicles and home appliances and others embedded
with electronics, software, sensors, actuators, and connectivity which enables the exchange of
data. uses of Matlab help in the design, prototype, and deployment of IOT applications such as
predictive maintenance, operations optimization, supervisory control etc.
After creating a fit, you can apply a variety of post-processing methods for plotting, interpolation,
and extrapolation; estimating confidence intervals; and calculating integrals and derivatives.
You can tune compensator parameters using interactive techniques such as Bode loop shaping
and the root locus method. The toolbox automatically tunes both SISO and MIMO compensators,
including PID controllers. Compensators can include multiple tunable blocks spanning several
feedback loops. You can tune gain-scheduled controllers and specify multiple tuning objectives,
such as reference tracking, disturbance rejection, and stability margins. You can validate your
design by verifying rise time, overshoot, settling time, gain and phase margins, and other
requirements.
4. Signal Processing Toolbox
It provides functions and apps to analyze, preprocess, and extract features from uniformly and
nonuniformly sampled signals. The toolbox includes tools for filter design and analysis,
resampling, smoothing, detrending, and power spectrum estimation. The toolbox also provides
functionality for extracting features like changepoints and envelopes, finding peaks and signal
patterns, quantifying signal similarities, and performing measurements such as SNR and
distortion. You can also perform modal and order analysis of vibration signals.
5. Mapping Toolbox
It provides algorithms and functions for transforming geographic data and creating map displays.
You can visualize your data in a geographic context, build map displays from more than 60 map
projections, and transform data from a variety of sources into a consistent geographic coordinate
system.
Mapping Toolbox supports a complete workflow for managing geographic data. You can import
vector and raster data from a wide range of file formats and web map servers. The toolbox lets
you process and customize data using trimming, interpolation, resampling, coordinate
transformations, and other techniques. Data can be combined with base map layers from multiple
sources in a single map display. You can export data in file formats such as shapefile, GeoTIFF,
and KML.
With DSP System Toolbox you can design and analyze FIR, IIR, multirate, multistage, and
adaptive filters. You can stream signals from variables, data files, and network devices for system
development and verification. The Time Scope, Spectrum Analyzer, and Logic Analyzer let you
dynamically visualize and measure streaming signals. For desktop prototyping and deployment to
embedded processors, including ARM® Cortex® architectures, the toolbox supports C/C++ code
generation. It also supports bit-accurate fixed-point modeling and HDL code generation from
filters, FFT, IFFT, and other algorithms.
9. Datafeed Toolbox
It provides access to financial data, news and social media data, and trading systems. You can
establish connections from MATLAB® to retrieve historical, intraday, or realtime data streams and
then perform analyses, develop models and financial trading strategies, and create visualizations
that reflect financial and market behavior.
You can use the streaming and event-based data in MATLAB to build automated trading
strategies that react to market events via industry-standard or proprietary trade execution
platforms. The toolbox includes functions for analyzing transaction costs, accessing trade and
quote pricing data, defining order types, and executing orders.
Stochastic differential equation (SDE) tools let you model and simulate a variety of stochastic
processes. Time series analysis functions let you perform transformations or regressions with
missing data and convert between different trading calendars and day-count conventions.
Text Analytics Toolbox includes tools for processing raw text from sources such as equipment
logs, news feeds, surveys, operator reports, and social media. You can extract text from popular
file formats, preprocess raw text, extract individual words, convert text into numerical
representations, and build statistical models.
Using machine learning techniques such as LSA, LDA, and word embeddings, you can find
clusters and create features from high-dimensional text datasets. Features created with Text
Analytics Toolbox can be combined with features from other data sources to build machine
learning models that take advantage of textual, numeric, and other types of data.
EXPERIMENT 2
A) Transpose
Code
a = [1 3 5; 2 4 6; 7 8 9]
b = transpose(a)
Output
B) Inverse
Code
a = [1 3 5; 2 4 6; 7 8 9]
g = inv (a)
Output
C) Multiplication
Code
a=[1 3 5;2 4 6;7 8 9 ]
b=[1 2 3;4 5 6;7 8 9]
c=a*b
Output
D) Concatenation
Code
a=[1 3 5;2 4 6;7 8 9 ]
b=[1 2 3;4 5 6;7 8 9]
d=[ab]
Output
EXPERIMENT 3
Code
A=[12 62 93 -8]
D=Min(A)
B= sort(A)
Output
EXPERIMENT 4
A) 2D Plotting
Code
%for constant doc f
= [100 63 40 16];
s9 =[0.68 0.62 0.5 0.36];
s13= [0.66 0.54 0.46 0.35];
s18= [0.66 0.52 0.4 0.35];
s25 =[0.64 0.5 0.4 0.32];
plot (f,s9, '--bo', f, s13, '--ro', f,s18, --go', f, s25, '--yo');
xlabel('feed (mm/mm)');
ylabel('surface roughness (micro m) ');
Output
A) 3D Plotting
Code
x = linspace(-2,2,20);
y = x';
[X, Y] = meshgrid(x, y);
Z = sqrt(2 - X.^2 - Y.^2);
surf(X, Y, Z);
Output
EXPERIMENT 5
A) Write a MATLAB program to find the first 10 terms of the Fibonacci series
using For loop.
Code
clc
clear all
% Call the Fibonacci function and specify the number of terms
Fibonacci(10);
function fibn = Fibonacci(n)
% Initializing first two values for Fibonacci sequence
fibn = zeros(1, n);
fibn(1) = 0;
fibn(2) = 1;
% Generating Fibonacci sequence
for i = 3:n
fibn(i) = fibn(i - 2) + fibn(i - 1);
end
end
Output
B) Write a MATLAB program to find all terms of Fibonacci series with values less
than 300 using While loop
Code
clc
clear all
Fibonacci(300);
function fibn = Fibonacci(n)
fibn = [1 1];
i = 3;
while fibn(i - 1) < n
fibn(i) = fibn(i - 2) + fibn(i - 1);
i = i + 1;
end
fibn = fibn(1:end - 1);
end
Output
EXPERIMENT 6
Code
v0 = 20;
g = 9.8;
y = 0;
t = 0;
while (y >= 0)
disp(['at t = ', num2str(t), ', location = ', num2str(y)]);
t = t + 0.1;
y = v0 * t - g * t^2 / 2;
End
Output
EXPERIMENT 7
Code
Function result = myFunction(n,x)
C= [1];
vec = [1:n];
C = [C, 1./vec];
a= [1,x.^vec];
result = sum (C. *a);
end
EXPERIMENT 8
Code
close all
clear all
myimage = imread('C:\Users\devan\Desktop\yo.jpeg');
mycolorimage = imresize(myimage, [256,256],'nearest');
mygrayimage = rgb2gray(mycolorimage);
mybinimage = im2bw(mycolorimage);
subplot(2,2,1);
imshow(mycolorimage);
title('Original Colour Image');
subplot(2,2,2);
imshow(mygrayimage);
title('Gray Image');
subplot(2,2,3);
imshow(mybinimage);
title('Binary Image');
subplot(2,2,4);
improfile(mygrayimage, [10,50], [45,100]);
ylabel('Pixel Value');
xlabel('Distance');
title('Intensity Profile of the Given Image');
Output
EXPERIMENT 9
AIM: Write a brief introduction about Simulink. Also, create a model and show the
simulation for that model
Model
EXPERIMENT 10
AIM: Write a code to generate and plot a sinusoidal signal with frequency 100 Hz and
amplitude 1 V
CODE
f = 100; % Frequency in Hz
A = 1; % Amplitude in V
t = 0:0.01:1; % Time vector in seconds
y = A * sin(2 * pi * f * t); % Sinusoidal signal
plot(t, y); % Plot the signal
title('Sinusoidal Signal');
xlabel('Time (s)');
ylabel('Amplitude (V)');
OUTPUT
EXPERIMENT 11
CODE
% Calculate the Fourier transform of a square wave
n = 0:100;
x = ((n >= 25) & (n < 75)) + 1;
X = abs(fft(x));
% Plot the magnitude of the Fourier transform
plot(abs(X));
xlabel('Frequency (Hz)');
ylabel('Magnitude');
OUTPUT