Effect of Noise on Signal in MATLAB

Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge about Affect of Noise on Signal in MATLAB. Noise is basically an unwanted signal that effects the normal signal. Noise the natural signal which can be removed but can be reduced to some extent. We can see a lot of examples of the signals effected by noise in our daily lives e.g. the distorted voice signal while calling, creates hearing problems, distorted TV signal makes the video invisible and the distorted AC signal can burn most of the home as well as other appliances. In signal processing term, noise is also known as the unwanted signal which carries no useful information. To recover the original signal from the noise effected one, is the basic and necessary goal of the signal processing. All of the filters including low pass, high pass, band pass, band reject (notch) are also designed for this purpose. Noise can never be removed completely but we can make its magnitude lower to some extent.

Effect of Noise on Shape of Signal

Here, in the tutorial Effect of Noise on Shape of Signal, I will elaborate that how noise an effect the shape and the information carried by the normal signal. Since noise is a random and unwanted signal having no useful information, so it has no fix shape, instead it could of any shape. Some of the shapes of the noise signals are shown below.
  • Noise across the time with random amplitude is shown in the figure below.
  • The noise signal displayed on the oscilloscope is shown in the figure below.
  • You can download the MATLAB simulation here by clicking on the button below.
  • Download .rar file, extract it and enjoy the complete simulation.

Block Diagram
  • I have made a simple block diagram to explain the flow of the program.
  • The block diagram is shown in the figure below.
  • Noise is added in the signal and hence generated the noise effected signal.
Code Description
  • Just copy and paste the source code given below in your editor.
t=0:0.01:1;%time duration
x=sin(2*pi*5.*t);%orignal signal
noise = rand(1,101);%noise signal
corrupted_signal=x+noise;%noise effected signal
subplot(311);%division of figures
plot(t,x);%plotting
title('Orignal Signal');%title
subplot(312)%division of figures
plot(t,noise);%plotting
title('Noise Signal');%title of the corresponding signal
subplot(313)%division of figures
plot(t,corrupted_signal);%plotting
title('Corrupted signal');%title of the corresponding signal
  • First of all I have defined the time duration at which the signal is defined.
  • Then I have generated the original sinusoidal signal.
  • After that, I have generated a random noise.
  • Then the noise effected signal has been generated.
  • I have plotted all of the signals on the same figure but in different sections in order to visualize all of them.
  • As you run the program, a new figure having graphs will be appeared on the screen.
  • The figure containing graphs of all the signals is shown in the figure below.
  • That was the brief description of the source code for visualizing the Effect of Noise on Shape of Signal.
So, that is all from the tutorial Effect of Noise on Shape of Signal. I hope you enjoyed this tutorial. If you find any sort of problem, you can ask in comments anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. In my next tutorial I will elaborate that how to create a simple Graphical User Interface (GUI) in MATLAB and how to use it. I will further explore MATLAB in my later tutorials by making further projects on it and will share them with all of you as well. So, till then, Take Care :)

Convolution in MATLAB

Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge about how to convolve the signals using an amazing software tool, MATLAB. MATLAB is an efficient tool for signal processing. MATLAB basically works on matrices. First of all I would like to tell you a bit about the convolution. In engineering terms, convolution describes the output of the Linear Time Invariant (LTI) systems.

Convolution is basically an integral which tells us about the overlapping of one function as it is shifted over another function. Convolution and cross correlation are similar. It has a wide range of applications e.g. computer vision, probability, statistics, engineering, differential equations, signal processing etc.

Convolution in MATLAB

Here in the tutorial, Convolution in MATLAB, I will tell you that how to convolve the two signals in MATLAB using built-in command, conv. Before going into the details of this tutorial, I would like to explain you about the convolution and its mathematical form.

  • You can download the MATLAB code or convolution of two signals here by clicking on the button below.
  • Download .rar file, extract it and enjoy the simulation.

In simple engineering terms, convolution is used to describe the out of the Linear Time Invariant (LTI) systems (the systems which shows different response at different times). Convolution is similar to cross correlation. Input output behavior of the system can be estimated with the help of the impulse response of that system. And the output of the system can be obtained by convolving the input applied to the system and impulse response of that system.

  • Suppose x(t) is the input applied to the system and h(t) is the impulse response of the system.
  • Its output y(t) can be obtained using the mathematical expression given below.

y(t) = x(t)*h(t)

  • In above expression * sign expresses the convolution between the input and the impulse response of the system.
Block Diagram
  •  I have made a very simple block diagram representation of convolution.
  • The input x(t) is applied to the system.
  • The system has convolved the input x(t) and the impulse response of the system h(t) to obtain its output y(t).
  • The block diagram is shown in the figure below.
Signal Representation
  • The convolution can also be represented in the form of signals.
  • The figure shown below displays the convolution between input and impulse response of the system in order to obtain its output.
Source Code Description
  • Just copy and paste the source code give below in your MATLAB editor to observe the convolution results.
clc %clears the command window
clear all %clears the workspace
t1 = 0:1:1;%time duration for the first signal
t2 = 0:2:10;%time duration for the second signal
f1 = 3;%frequency of the first signal
f2 = 5;%frequency of the first signal
x = sin(2*pi*f1.*t1);%first signal
y = cos(2*pi*f2.*t2);%second signal
convolution = conv(x,y) %convolution of both the signals x & y
  • You can see first of all I have cleared the command window and the workspace.
  • Then I have declared time duration for both the signals.
  • After that I have defined the frequency for the both signals.
  • Then I have defined the two different sinusoidal signals.
  • At the end I have convolved both of them and removed the semicolon at the end of the statement in order to observe the results on command window in MATLAB.
  • So, that was the brief description of the code, you can download it from the above button.
  • The result shown on the command window are shown in the figure below.
  • That was the brief discussion about how to convolve two signals in MATLAB using builtin commands conv.

So, that is all from the tutorial Convolution in MATLAB. I hope you enjoyed this tutorial. If you find any sort of problem, you can ask in comments anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. In my next tutorial I will elaborate that how to declare the variables in MATLAB and how to manipulate them without assigning them with the values. I will further explore MATLAB in my later tutorials. So, till then, Take Care :)

ECG Digitization in MATLAB

Buy This Project Hello friends, I hope you all are doing great. In today's tutorial, I am going to show you How to do ECG Digitization in MATLAB. If you are new to ECG signals then you should have a look at Introduction to ECG. I have also posted many different simulations on ECG in which I have extracted different features of ECG signals but in today's tutorial, we are gonna extract the ECG signal itself from its image. I have also saved this ECG signal in a txt file so that you can use it. This code is not open source and you can buy it from our shop by clicking the above button. I have designed a GUI in MATLAB and it will take image of ECG signal as an input and then will give the digital form of that ECG signal as an output. There are few restrictions on this code and its not necessary that it will work on all images of ECG signal, but I am sure it will work on most of them. I have also added three images in the folder which works great with this code. You should also have a look at ECG Simulation using MATLAB and ECG Averaging in MATLAB. So, let's get started with ECG Digitization in MATLAB:

ECG Digitization in MATLAB

  • When you will buy this MATLAB code, you will get an rar file.
  • Extract this rar file and it will contain below files in it:
  • You need to run Main.m file which is a MATLAB file.
  • Open this file in MATLAB and run it.
  • If everything goes fine then it will open up as shown in below figure:
  • Click this button which says Load Image File.
  • When you click this button, it will open up a dialog box as shown in below figure:
  • Here you need to select the image of ECG signal, which you want to digitize.
  • So, I am selecting ECG1.png and the results are shown in below figure:
  • The first axes is showing the ECG Image file as it is.
  • I have converted this ECG Image File into Gray Scale which is shown in axes 2.
  • Further, I have converted this Dray Scale Image into Binary Image which is shown in axes 3.
  • If you have noticed we have a blue line in ECG Binary Image.
  • I have added this line and taken it as an x-axis, the algo is reading the values of black pixels and then subtracting it from this x axis line.
  • In this way, I am getting my complete ECG Signal and the Axes 4, which is named as ECG Signal, is displaying this digital ECG Signal.
  • I have converted pixels into mV, which you can change by yourself in the code.
So, that was all about ECG Digitization in MATLAB. If you got into any trouble regarding this project then you can ask in comments and I will try my best to resolve them. Thanks for reading !!! :)

ECG Averaging in MATLAB

Buy This Project Hello friends, I hope you are doing great. Today, I am going to share an expert level project which is ECG Averaging in MATLAB. If you are new to ECG then you should have a look at Introduction to ECG. I have already shared ECG Simulation using MATLAB in which we have seen how to simulate an ECG signal and then diagnose heart disease. We have also extracted ECG features in that project. So, if you guys haven't read that tutorial then I would suggest you to not read this one. First read ECG Simulation using MATLAB and then you should read this tutorial. Today's project is quite an extension of our previous project ECG Simulation using MATLAB. Our team has designed this project after quite a lot of effort that's why its not free to use but you can easily buy it from our shop using PayPal, by clicking the above button. In today's tutorial, we are gonna have a look at How to do ECG Averaging in MATLAB. ECG Signals normally have a lot of noise in them that's why its quite necessary sometimes to average the ECG signal so that we get better results. That's where ECG averaging is required. So, lets get started with ECG Averaging in MATLAB.

ECG Averaging in MATLAB

  • Let me first explain in detail why we need to average an ECG signal and how we are gonna do that.
  • Check ECG signal shown in below figure:
  • In the above ECG signal, we can see there's a lot of noise in ECG waveform, which may affect our results so there's a need to apply some filters to smoothen out the ECG waveform.
  • Another way of removing noise is ECG averaging.
  • In ECG averaging technique, we cut signle ECG signal and then we extract all of our peaks.
  • Finally we add them up and create an average waveform.
  • I have shown this whole procedure in below figure:
 
  • In the above figure, you pretty much got the idea behind this project.
  • Now here's its MATLAB GUI, shown in below figure:
  • It has two Containers at top and a full length Graph at the bottom.
  • Now, when you Click the Button the it will ask for the ECG data file, as shown in below figure.
  • Currently this project has eight data files with it and I have tested all of them and they are working quite fine.
  • I have downloaded all the data files from Phsio Bank website. You can read its more details in ECG Simulation using MATLAB.
  • Now when you will upload the files then it will take all the peaks and then will add them up one by one and will give you final output in the right container.
  • The whole procedure for data1 is shown in below figure:
  • I hope now you got the complete idea of its working but still if you have any questions then you can ask in comments and I will help you out.
  • Here's the final look of this project:
  • I have also created this video in which I have explained it in more detail and shown how it works.
  • So, if you wanna buy this Project then I would suggest you to must watch this video before so that you got the complete idea of what you are buying.
  • Here's the video for ECG Averaging in MATLAB:
So, that's all for today. I hope you have enjoyed today's tutorial. Will see you guys in next tutorial. Till then take care and have fun !!! :)

How to use Print MATLAB

Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge about How to use Print MATLAB. As you all know that the design of an algorithm is not enough until we observe its results too. So, there should be a debugging tool in order to check the performance and accuracy of the designed algorithm. Debugging tool helps us to improve the algorithm’s performance and accuracy too by observing its output again and again. In this tutorial I will tell you about using print command in MATLB for different purposes. So, in this tutorial I am going to use print command as a debugging tool in order to observe the output of the algorithm. You should also have a look at how to use MATLAB ? I am going to use print command to either print the desired statement on the command window in MATLAB or to display the graphs on a figure and to automatically save it on any destination wherever you want to. I will elaborate this command with the help of the different examples later in this tutorial. if you new to MATLAB then you should read Introduction to MATLAB. So, now let's have a look at How to use Print MATLAB:

How to use Print MATLAB

In the tutorial How to use Print MATLAB, I will tell you about the use of this command in MATLAB while explaining a lot of examples and by displaying their results. The examples include the printing of the statement on the command window in MATLAB as well as to display the graphs and to save its image.
  • Here, I am going to print some statement (the name of our website) on the command window using this particular command in m.file.
  • The use of the command fprintf is shown below.
clc % clears the command window
fprintf('www.TheEngineeringProjects.com\n')% prints the desired statement
  • Editor also displays that command in the figure shown below.
  • You can observe the result of this statement on the command window in MATLAB.
  • The result displayed on the command window is shown in the figure below.
  • So, that was about how to print the statement on the command window.
  • Now, I am going to print the result of some mathematical operations applied on some variables, on command window using the same command.
  • I have assigned different values to the two variables a and
  • I have calculated their sum and displayed on the command window.
  • The commands written on the editor are shown in the figure below.
  • The result of the above commands displayed on the command window is shown in the figure below.
  • So, that was the description of how to print the results mathematical operations applied on some variables on command window.
  • Now, I am going to perform some operations on matrix.
  • The source code written in editor of the MATLAB is shown below.
  • I have initialized a matrix named as
  • I have then displayed that matrix on the command window.
  • At the end, I have printed all the values of that matrix on the command window.
  • The result of all the above commands displayed on the command window is shown in the figure below.
  • First row in the above figure displays the matrix.
  • And the second row prints each value of the matrix in next ling using \n.
Graphics Format File
  • You need to specify file name and format switch to save your figure as graphics.
  • The supported output formats for exporting from MATLAB and switch settings are shown in the table given below.
Print Paper Copy of Figure
In this method a new bar chart will be created and printed to your system default computer. If you do not specify the figure to be printed, then print will use the current figure.
  • The source code written on the editor is shown below.
clc
bar(1:10);
print 
  • The editor window with the code is also shown in the figure below.
  • The figure generated from the above code is shown below.
  • That was the detailed discussion about using print command as a debugging tool in MATLAB.
So, that is all from the tutorial How to use Print MATLAB. I hope you enjoyed this tutorial. If you face any sort of problems regarding anything, you can ask me freely in comments every time, without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. There's another interesting MATLAB Projects named as Eye Ball Detection in MATLAB. I will explore different software including MATLAB in my next tutorials and will share all of them with you guys as well. So, till then, take care :)

Multi Color Detection in MATLAB

Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge about Multi Color Detection in MATLAB. Color Detection scheme plays a vital role at some places. Like in Image processing technique the detection of specific color among the different colors is necessary to perform some action on it. For example there are three cars of the colors red, blue and green and we want to wash the red car. You should also have a look at Color Detection in Images using MATLAB because I am gonna use the same code and will add some improvements in it. Moreover, if you are working on Live Videos instead of Images then you should have a look at Color Detection in Live Video using MATLAB. For this purpose we need to design an algorithm which is capable of detecting red color among the different colors. Similarly there are a lot of other examples are there to perform the tasks like that. This tutorial will elaborate the step by step explanation of the algorithm designed for multi color detection in MATLAB using Graphical User Interface (GUI). The tutorial consists of two different parts. In first part the GUI will be created while the second part will consist of an algorithm to detect a particular color among the different colors. Further details about the designed algorithm is elaborated in the section below.

Multi Color Detection in MATLAB

Here, in the tutorial Multi Color Detection in MATLAB, I will explain the step by step description about designing an algorithm for multi color detection in MATLAB GUI. The total project is divide into two parts, GUI will be created in the first part and algorithm designing will be explained in the second part.
  • You can download the complete MATLAB GUI simulation here by clicking on the button below.
  • Download .rar. file, extract it and enjoy the complete package :)

Download MATLAB Simulation

GUI Design for Multi Color Detection in MATLAB
This section of the tutorial Multi Color Detection in MATLAB will elaborate you all of the steps involved during the design of Graphical User Interface (GUI).All of the steps are given below.
  • GUI design consists of several different steps which are explained below.
  • GUI consists of the two different panel.
  • The left panel is for browsing or loading an image from the laptop or computer.
  • Left panel has a button to browse an image, an axis to visualize the loaded image and edit box to view the image's complete path.
  • The right panel is designed for color detection for the browsed image.
  • Right panel has three different buttons in order to detect red, green and blue colors and an axis to display the detected color on the image loaded in the left panel.
  • So that was the detailed description of the GUI, designed for multi color detection in MATLAB.
  • Initially designed GUI without panels is shown in the figure below.
  • The updated GUI with both the panels with proper tags is shown in the figure below.
Other Image Processing Projects:
Algorithm Design for Multi Color Detection in MATLAB
In this section of the tutorial Multi Color Detection in MATLAB, I will explain you about the design of an algorithm for detecting multi colors from the image loaded into GUI. The algorithm is further divided into two different parts. In the first part image is loaded into the GUI for the detection of multi color. Whereas, the second step consists of the detection of multi colors and its display on the GUI.
  • Go to the call back back function of Browse button and just copy paste here, the MATLAB code given below.
global ImageFile
[filename pathname] = uigetfile({'*.jpg';'*.bmp'},'File Selector');
    ImageFile = strcat(pathname, filename);

axes(handles.axes1);
imshow(ImageFile) % displays the image on particular axis
set(handles.edit1,'string',ImageFile); %sets the text of the edit box on GUI
  • I have first write a line to load the image from its path into the GUI.
  • After loading the images I have adjusted an axis on which the image is to be displayed.
  • At the end I have set the text of the edit box as the address of the image.
  • So that the was the logic to load an image into GUI of MATLAB.
global ImageFile
ImageFile
data = imread(ImageFile);

    diff_im = imsubtract(data(:,:,1), rgb2gray(data)); % subtracts the red color from the image
    %Use a median filte tFileo filter out noise
    diff_im = medfilt2(diff_im, [3 3]);
    diff_im = im2bw(diff_im,0.18);
    
    diff_im = bwareaopen(diff_im,300);
    
    bw = bwlabel(diff_im, 8);
    
    stats = regionprops(bw, 'BoundingBox', 'Centroid');
    
    % Display the image
    axes(handles.axes2); % axis adjustment
    imshow(data) % displays the image with the detected colors
    
    hold on
 
    for object = 1:length(stats)
        bb = stats(object).BoundingBox;
        bc = stats(object).Centroid;
        rectangle('Position',bb,'EdgeColor','r','LineWidth',2)
        plot(bc(1),bc(2), '-m+')
        a=text(bc(1)+15,bc(2), strcat('X: ', num2str(round(bc(1))), ' Y: ', num2str(round(bc(2)))));
        set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12, 'Color', 'blue');
    end
    
    hold off
  • The main part of this code is to subtract the red color from the loaded image and to display it on the axis.
  • I have made rectangular areas around the detected colors at the end.
  • So that was the description of the algorithm to detect the red colors from the loaded image.
  • The final Updated GUI is shown in the figure below.
  • The image is to be loaded in the left panel of the updated GUI.
  • Loaded image in to the GUI is shown in the figure below.
  • Color will be detected in the right panel.
  • Red color detected from the loaded image is shown in the figure below.
  • Green color detected from the loaded image is shown in the figure below.
  • Blue color detected from the loaded image is shown in the figure below.
So that is all from the tutorial Multi Color Detection in MATLAB. I hope you enjoyed this tutorial. If you face any sort of problems, you can freely ask me in comments any time without even feeling any kind of hesitation. Our team will try our level best to entertain you and to solve your issues in some better way, if possible. I will explore MATLAB as well as other software in my later tutorials and will surely share all of them with you guys as well. So, till then, Take Care :)

How to use MATLAB input Function

Hello everyone! I hope you all will be fine and having fun. Today, I am going to share my knowledge about How to use MATLAB input Function. In this tutorial I would like to tell you about the importance of getting data from the user in MATLAB. If you want to display the data to users, you need to get data from them as well according their requirements. I hope you have read How to use MATLAB ? In this way the same source code written in MATLAB will give different result according to the requirements of the each user. So, in other words the source code becomes generic in this way. As we run the program, command window of the MATLAB asks user to enter the desired input. The results on this window are generated according to the Matlab input given by the user. You should also have a look at Laplace Transform in MATLAB.

How to use MATLAB input Function

Here, in this tutorial I will explain you the importance and the procedure about How to use MATLAB input Function. The one of the main advantage of getting the data from the user is, the algorithm becomes generic in this way. The different users can get different types of results from the same program according their requirements. The user has to enter the input on the command window and can get the desired results according to the given input.
Getting User Data
  • First of all open your MATLAB software and go to the editor in MATLAB.
  • Write a simple code in editor as shown below.
clc
x=input('Enter the value of x = ');
y=input('Enter the value of y = ');
x+y
  • Move to the command window and observe the results.
  • As you Run the program you will automatically move to the command window.
  • Command window will ask to enter the value of the first variable, which is x in this case.
  • The result of the above program is shown in the figure below:
Note:You should also have a look at these MATLAB projects as well:
  • After entering the value of x command window will ask to enter the value of the second variable, which is y in this case.
  • The figure shown below displays the above results.
  • As you enter the value of y and press Enter, you will be able to see the result of the addition of the both of the variables.
  • The result is shown in the figure below.
  • Till now, I have performed addition operation on the variables whose values are given by the users and the program shows the different results for each user.
  • You can also perform a lot of other operations on these variables.
  • Here, I am going to perform basic mathematics operations on these two variables.
  • The code for multiplication operation is shown below.
clc %clearing command window
x=input('Enter the value of x = ');%takes the value of x from the user
y=input('Enter the value of y = ');%takes the value of y from the user
product = x*y %performing multiplication
  • The input MATLAB code will look something as shown in below figure:
  • The result on the command window is shown in the figure below.
  • Now, I am going to perform the division operation on the both of the variables.
  • The source code for the division operation is shown below.
clc %clears comand window
x=input('Enter the value of x = '); %takes the value of x from the user
y=input('Enter the value of y = '); %takes the value of y from the user
product = x/y  %performing division operation
  • The result of the above source code is shown in the figure below.
  • Similarly you can perform a lot of other operations on the variables whose values are given by the user.
  • So, that was the brief discussion about How to use MATLAB input Function.
  • Here's the video in which I have explained in detail How to use MATLAB input Function:
So, that is all from the tutorial How to use MATLAB input Function. I hope you enjoyed this tutorial. If you find any sort of problem, you can ask in comments anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. You should also have a look at Introduction to MATLAB. In my next tutorial I will elaborate that how to generate rectangular signals in MATLAB and how to manipulate them. I will further explore MATLAB in my later tutorials by making further projects on it and will share them with all of you as well. So, till then, Take Care :)

How to use MATLAB

Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge about How to use MATLAB. This is an on demand tutorial. The tutorial will help you to learn the the basics of the MATLAB and will elaborate the use of the different tools of it e.g. command window, m.file, Graphical User Interface (GUI) and simulink. Before into the details of this tutorial you must go through Introduction to MATLAB first for the better understanding of this tutorial. Each of the tools has its own importance while making an algorithm in MATLAB. Command window basically deals with the shorter commands where there is a need of quick execution. Command window shows the result of all of the executed commands if there is no semicolon at the end of the particular statement. You must also have a look at Declaration of Variables in MATLAB. MATLAB provides high level of technical computing. It provides an easy to use environment for computation and programming to solve problems and their solutions can be expressed in mathematical symbolic notations. MATLAB can be used for a lot purposes e.g. computational mathematics, simulation, mathematical modeling, engineering graphics, data analysis, prototyping etc. MATLAB works on the basis of matrices whose basic building is an array. MATLAB system has different parts which will be discussed later in this tutorial. MATLAB has a lot of tool boxes in order to provide easiness to the users. Signal processing tool, fuzzy logic tool, control systems tool and simulation tool are its major tools that are used most frequently.

How to use MATLAB

Here in the tutorial, How to use MATLAB, I will tell you about the basics of the MATLAB and the necessary steps to use the different tools of the MATLAB e.g. command window, GUI, simulink and m.file. First of all I would like to tell you a brief description of the MATLAB software.
Parts of MATLAB
  • There are five different main parts of the MATLAB.
  1. MATLAB Language.
  2. MATLAB Working Environment.
  3. Handle Graphics.
  4. MATLAB Mathematical Functional Library.
  5. MATLAB Application Program Interface.
  • All of these five parts are shown in the figure below.
  • The brief description of each of the part is given below.
1) MATLAB Language
It provides high level matrices language. This language includes the features like flow statements, data structures, object oriented programming, input/output etc. It provides the facilities for programming at lower as well as on higher scales. We have posted many Matlab projects in which I have used MATLAB Language, here are few of these projects:
2) MATLAB Working Environment
This part provides set of tools and facilities to the MATLAB users. The facilities include the management of variables in workspace, debugging, m.files and import and export of the desired data. MTALB working environment is shown in the figure below:
3) Handle Graphics
This is a MATLAB system for graphics and it includes image processing and data visualization in two dimensions as well as in three dimensions. It also includes the designing of complete Graphical User Interface in MATLAB. Handle graphics in MATLAB is shown in the figure below:
4) MATLAB Mathematical Functional Library
  It has a wide range of computational algorithms from the lower level (e.g. sum, sine, cosine) to the higher level (e.g. matrices inverse, matrices eigen values etc.). Mathematical functional library is shown in the figure below.
5) MATLAB Application Program Interface (API)
It provides you a library to write C programs as well as Fortran programs which interact with the MATLAB. It provides a lot of facilities e.g. MAT files. MATLAB application program interface (API) is shown in the figure below.
  • So that was the brief description of the five different parts of the MATLAB.

How to use MATLAB Command Window

Here in this section of the tutorial How to use MATLAB, I will tell you about the the steps to use the command window in MATLAB and its importance in different circumstances. Command window is used to display the results of the algorithm immediately. When you do not specify an output variable whose values is desired to be obtained, then MATLAB uses a variable named as ans which is the short form of the word answer. This step is shown in the figure below. Command window is the window which displays the output in non-graphic form. The symbol >> shows that the MATLAB is ready for the input to be entered.
  • Here I would like to show you the use of command window.
  • I have declared three different variables named as a,b and c.
  • I have stored the value of the sum of first two variables in the third variable.
  • The result is shown in the figure below.
  • Command window will only display the result of that statement which has no terminating semi colon.
  • Now I am going to compute the values of trigonometric functions.
  • The result is shown in the figure below.
  • So that was the overview of how to use MATLAB command window.

How to use MATLAB m File

Here in this section of the tutorial How to use MATLAB, I will tell you about how to use the m.file in MATLAB. It is also known as the editor in MATLAB. You must also visit How to Create m.file in MATLAB for the better understanding.
  • I am going to add the simple two of the variables and storing it into the third variable while creating m.file in MATLAB.
  • The result of the above description is shown in the figure below.
  • Now, I am going to plot a simple sinusoidal signal while creating an m.file in MATLAB.
  • The source code is shown in the figure below.
  • The resulted plotted sinusoidal signal is shown in the figure below.
  • So, that was the brief description about How to create or use m.file in MATLAB.
Note:These are few MATLAB projects in which I have written the MATLAB code in m File:

How to use MATLAB Simulink

Here in this section of the tutorial How to use MATLAB, I will explain you that how to use this amazing tool of the MATLAB. It represents the source code in terms of different blocks. First of all I would like to tell you that how to open the simulink library in MATLAB.
  • You need to follow the steps given below.
  • Open your MATLAB software, a new window with different MATLAB sections will be appeared on your screen.
  • Click on the encircled button as shown in the figure below.
  • As you press this button, a new window having simulink library in it, will be opened on your screen.
  • The simulink library is shown in the figure below.
  • Now, I am going to generate two simple sinusoidal signal in MATLAB simulink.
  • Press Ctrl+N and a new window will appear upon which we need to place the desired blocks.
  • Go to the Sources and select the sine wave block from it.
  • Drag this blcok and drop it on the second window as shown in the figure below.
  • Similarly copy and paste the same block.
  • Here I am going to add the both of the sinusoidal signals having phase shift of 90 with each other.
  • I have placed a scope to observe the addition of the both of the signals visually.
  • All of the above steps are shown in the figures below.
  • The selection of the add block is shown in the figure below.
  • The selection of the scope is shown in the figure below in order to visualize the results.
  • Now, the complete source code for the addition of two sinusoidal signals is shown in the figure below.
  • After making this algorithm just run the program by clicking on the button encircled in the above figure.
  • Double click on the Scope in order to visualize the desired result.
  • The result of the addition of both the signals is displayed on the scope and is shown in the figure below.
  • So, that was the brief description about how to open and use simulink library in MATLAB.

How to use MATLAB GUI

In this section of the tutorial How to use MATLAB, I will explain you about how to create Graphical User Interface (GUI) in MATLAB and how to operate it. GUI displays the desired results visually which helps us in better understanding of the algorithm instead of observing the results in analog form or in digital data. It also provide better external look to the designed algorithm. You should also have a look at How to Create a GUI in MATLAB. I have designed many projects using GUI in MATLAB so you go through these below projects: In order learn that how to perform different tasks using GUI in MATLAB, you need to follow the below steps:
  • Go to the command window and type guide there.
  • The step is shown in the figure below.
  • When you press Enter a new window will be appeared on your screen.
  • Go to the Create New GUI and select the blank GUI and hence a new GUI will be opened and its source code will be generated automatically in m.file of the MATLAB.
  • The above steps are shown in the figure below.
  • Now, pres OK button and a GUI will be appeared on your screen.
  • The GUI appeared on the screen is shown in the figure below.
  • Now you can pick and place the buttons, tables and graphs from the left side of the GUI.
  • I picked a graph, a table and a button from the left bar of the GUI.
  • All of the above steps are shown in the figure below.
  • That was the overview of the basics of the MATLAB.
So that is all from the tutorial How to use MATLAB. I hope you enjoyed this tutorial. If you face any sort of problem regarding anything, you can anytime ask me in comments, freely, without even feeling any kind of hesitation. I will try my level best to solve you issues in some better way, if possible. I will explore MATLAB and other software and hardware too in my later tutorials later and will surely share them with all of you guys as well. So, till then, Take Care :)

How to Clear MATLAB Windows

Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge with all of you guys about How to Clear MATLAB Windows. If the command window and workspace window are not clear they present a very complicated look and hence the user feel it difficult to write code on command window. Here, I have compiled a list of awesome MATLAB Image Processing Projects so must check them out to get some inspiration. :) So, for the ease of the user we need to clear the both window specially the command window because it contains the entire code for any of the task. Before going into the details of this tutorial, you should go through Introduction to MATLAB and Declaration of Variables in MATLAB for the better understanding of this tutorial. If we want to avoid the complications while writing the code on command window we must need to clear the both command window as well as the workspace window. If you don't wanna work on Command Windows then you should have a look at How to Create m File in MATLAB.  Anyways, in today's tutorial we are gonna have a look at matlab clear command window and its quite easy but I must say its quite handy, especially when you are working on some complex MATLAB Project.. So, now let's get started with today's tutorial and have a look at How to Clear MATLAB Windows:

How to Clear MATLAB Windows ???

In the tutorial, Clearing MATLAB Windows I will show that which commands are required to use to clear the command window and workspace window In order to avoid the complications for the user while writing the source code on the command window.
  • The commands for clearing the command window and workspace window are shown below.
  1. clear all (used to clear the workspace window)
  2. clc (used to clear the entire command window)
  • The command window with some of the commands written on it is shown in the figure below.
  • The workspace window having some of the variables is shown in the figure below.
Clearing both the Windows
  • First of all I will show you that how to clear the workspace window.
  • Go to the command window and write the command clear all and press
  • All of the above steps are shown in the figure below.
  • You will see that all the variables from the workspace window has been removed.
  • The cleared workspace window is shown in the figure below.
  • Now go to the command window and write the command clc on it.
  • The command written on the command window is shown in the figure below.
  • If you press Enter after writing the command show in the figure above, on the command, you will see that the command window has be cleared.
  • The empty command window is shown in the figure below.
  • So, by clearing both of these window a user can easily make an algorithm without any complication.
  • You should also have a look at this video tutorial as well:
That is all from the tutorial, Clearing Command Window and Workspace in MATLAB. I hope you enjoyed this tutorial. If you face any sort of problem in clear command window matlab, you can ask me in comments anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. In my next tutorial I will explain you that how to Calculate the Values of the Trigonometric Functions in MATLAB. I will explore MATLAB further in my later tutorials and will share all of them with all of you as well. So, till then, Take Care :)

How to Create m File in MATLAB

Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge about How to Create m File in MATLAB. It is also known as New Script or Editor in the MATLAB. It's an amazing MATLAB tool. We can write the complete source code on editor. If we want to visualize the result of the particular statement we should not put a semicolon after that statement in MATLAB. Before going into the details of this tutorial, you must first have a look at Introduction to MATLAB and if you don't know about MATLAB variables then you must read Declaration of Variables in MATLAB. By doing this and by pressing the Run (Green Color) button at the top of the editor we will be able to see the result on the command window. In other words, we have to write the entire source code in the editor and to run the program and the desired results will be displayed on the command window. It is easy to do so as compared to write and manipulate every single statement on command window.

How to Create m File in MATLAB ???

Here, in the tutorial How to Create m File in MATLAB, I will show you the step by step procedure to create an m file in MATLAB first and then to observe the desired results on command window.
  • First of all you need to open your MATLAB software.
  • Go to the top left corner of the front window of the MATLAB and click on New Script.
  • The above steps are shown in the figure below.
  • A new window will be appeared on your screen right after clicking on the New Script.
  • The second window appeared on the screen is shown in the figure below and it is also known as an Editor.
  • A very simple code written on the editor by declaring three different kinds of variables and their manipulation is shown in the figure below.
  • Now, if you want to observe the result on the command window you have to do two things.
  • The first thing is to remove the semicolon at the end of the statement as shown in the figure above.
  • And the second thing is to press Run button encircled in the figure shown above.
  • After following all of the above steps you will be able to visualize the results on the command window of the amazing software i.e. MATLAB.
  • The result observed on the command window is shown in the figure below.
  • You can see the result is obtained in the form of an equation.
  • That was the detailed discussion on Creating m.file in MATLAB.
So, that is all from the tutorial Creating m.file in MATLAB. I hope you enjoyed this tutorial. If you face any sort of problem you can ask me in comments anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. In my next tutorial I will explain you that how to Calculate the Values of the Trigonometric Functions in MATLAB. I will explore MATLAB further in my later tutorials and will share all of them with all of you as well. So, till then, Take Care :)
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir