Found 163 Articles for MATLAB

Trapezoidal Numerical Integration without using trapz in MATLAB

Manish Kumar Saini
Updated on 18-Jul-2023 13:14:55

307 Views

Introduction to Trapezoidal Numerical Integration Trapezoidal numerical integration is a method used for finding the approximate value of a definite integral. It is also called as the trapezoidal rule. In the case of trapezoidal numerical integration method, we use trapezoids to calculate the area under a curve. In the trapezoidal rule, the total interval over which we want to integrate is divided into smaller subintervals. The area under the curve is then approximated in each subintervals by using trapezoids. After that the total area under the curve is estimated through the sum of the areas of sub-trapezoids. This ... Read More

Read Words in a File in Reverse Order in MATLAB

Manish Kumar Saini
Updated on 18-Jul-2023 13:04:05

70 Views

Consider a text file containing a sentence “I Study MATLAB from Tutorials Point.” Now, we want to read these words of the text file in the reverse order, the result will be “Point Tutorials from MATLAB Study I.”. In this article, we will explore the implementation of MATLAB program to read words in a text file in reverse order. Algorithm: Read Words in a File in Reverse Order In MATLAB, we have to follow the following steps to read the words in a file in reverse order: Step 1 - Open the file for reading by calling the function ... Read More

Intensity Transformation Operations on Images in MATLAB

Manish Kumar Saini
Updated on 18-Jul-2023 13:01:33

1K+ Views

Introduction to Intensity Transformation in MATLAB In MATLAB, the intensity transformation operation on images is one of the most fundamental image processing technique. It is an image processing operation in which the results depend on the intensity of an image. In MATLAB, the intensity transformation operations on images are performed to correct, enhance, or manipulate the intensity of image pixels. We have various built-in MATLAB functions to perform intensity transformation operations on images. In this article, we will discuss some commonly used intensity transformation operations and will see how they can be implemented using MATLAB programming. Intensity ... Read More

How to Set Axis Tick values in MATLAB?

Manish Kumar Saini
Updated on 18-Jul-2023 12:56:06

252 Views

To apply custom axis tick values, MATLAB has two built-in functions “xticks()” and “yticks()”. Here, the “xticks()” function is used for customizing the tick values of X-axis in a MATLAB plot, while the “yticks()” function is used for setting custom tick values to Y-axis. Syntax xticks([custom_tick_values]); yticks([custom_tick_values]); The following MATLAB program demonstrate the use of “xticks()” and “yticks()” functions to create custom tick values for X-axis and Y-axis. Example % MATLAB program to specify custom axis tick values % Create a sample vector of data x = linspace(1, 5, 5); y = x.^2; % Plot the x ... Read More

How to Set Axis Limits in MATLAB

Manish Kumar Saini
Updated on 18-Jul-2023 12:59:21

1K+ Views

MATLAB provides various built-in functions, such as xlim(), ylim(), and axis() that help us to adjust axis limits as per our requirements. In this tutorial, we will learn about adjusting axis limits of a plot in MATLAB. Functions to Set Axis Limits In MATLAB, there are three main functions widely used for adjusting axis limits of a plot. These functions are as follows: “xlim()” Function - The “xlim()” function is used to adjust X-axis limit of a plot in MATLAB. “ylim()” Function - The “ylim()” ... Read More

How to Create Logarithmic Scales in MATLAB

Manish Kumar Saini
Updated on 18-Jul-2023 12:38:11

496 Views

MATLAB has three built-in functions "semilogx", "semilogy", and "loglog" to covert the linear axis scales to logarithmic scales in a plot. Here, the “semilogx()” function is used to change the X-axis scale to a logarithmic scale. The “semilogy()” function is used to change the Y-axis scale to a logarithmic scale. The “loglog()” functions changes both X-axis and Y-axis scales to logarithmic scales. Syntax semilogx(x, y); semilogy(x, y); loglog(x, y); The following MATLAB program demonstrates the use of “semilogx()”, “semilogy()”, and “loglog()” functions to change the axis scales to logarithmic scales in MATLAB. Example % MATLAB program to ... Read More

How to Create Custom Axis Labels in MATLAB

Manish Kumar Saini
Updated on 18-Jul-2023 12:30:12

263 Views

MATLAB programming has different built-in functions to customize the axis labels. In this article, we will explore the creation of custom axis labels of a plot in MATLAB. Functions to Customize Axis Labels MATLAB has the following built-in functions to create customized axis labels: "xlabel()" Function - The “xlabel()” function is used to apply label for X-axis in MATLAB. "ylabel()" Function - The “ylabel()” function is used to apply label for Y-axis in MATLAB. ... Read More

How to Add Grid Lines in MATLAB

Manish Kumar Saini
Updated on 18-Jul-2023 12:26:01

614 Views

MATLAB provides various options to control the visibility of gridlines in a plot. By using these options, we can display or hide both major and minor grid lines. Gridline Control Options MATLAB has the a “grid” option that can accept three control values, i.e. “on”, “off”, and “minor” to control the visibility of gridlines in a plot. The “grid” option with value “on” displays the major grid lines in the plot, with value “off” hides the gridlines in plot, and with value “minor” it can display minor gridlines in the plot. It is important to note that when the “grid” ... Read More

Generating Random Number in MATLAB

Manish Kumar Saini
Updated on 18-Jul-2023 16:39:28

494 Views

In MATLAB programming, we can use various types of built-in functions to generate different types of random numbers. Random numbers are nothing but numbers selected randomly from a set of numbers. MATLAB provides the following four major functions to generate different types of random numbers depending on our requirements: rand() randn() randi() randperm() Let us discuss each of these four ... Read More

Floating Point Precision in MATLAB

Manish Kumar Saini
Updated on 18-Jul-2023 11:38:52

172 Views

In MATLAB, the numeric class consists of various data types, such as signed integers, unsigned integers, single-precision floating point number, and double-precision floating point numbers. In MATLAB, the floating point precision basically defines the number of significant digits that can be specified and manipulated by performing a floating point arithmetic operation. The IEEE 754 standard determines the default floating point precision in MATLAB. As per this standard, the floating point numbers are represented in the following two formats: Single-Precision Floating Point Number Double-Precision ... Read More

Advertisements