. Advertisement .
..3..
. Advertisement .
..4..
If you are curious about some common properties of MatLab LineStyle and how to use them, this guide is tailored for your needs. We will introduce the most common elements here, including Linestyle, LinecolorType, and LineWidth.
Properties of MatLab LineStyle
1. Linestyle
The Linestyle is among flexible properties that can alter a line’s layout. Multiple styles, like solid, dotted, and dashed, are available to differentiate multiple curves. Programmers also employ them to modify line objects such as arrows, surface parameters, curves in three-dimensional and two-dimensional, et cetera.
Nevertheless, we cannot use Linestyle to change axes or grid lines. Plot’s axes always display themselves in solid line styles.
How can we understand the dashed lines? Let’s use the given values in out input below:
Example:
x=1:0.1:10;
plot(x, sin(x),"LineStyle",'--');
As expected, the output of our given functions will showcase a dashed line’s shape.
2. LinecolorType
LinecolorType is among Matlab properties to change a line’s color. The default-drawn lines are established by Line Color properties, achieved by assigning your LineColorType properties as “Flat”.
These properties continue to break down into smaller categories, each described as below:
- Dichromatic:
Such properties are defined by the line’s points, whose coloring relies on your height values. LineColor properties impact the highest point of such lines. On the other hand, LineColor2 will decide the outcome of the lowest points.
What about some other points? The system plots them using linear interpolation within an RGB color scheme.
- Monochrome:
The colors are a mix of numerous blends – from Line-color to the dimmer part of Line-color properties.
Here, the coloring is a mixture of various blends starting from Line-color to the dimmed part of the Line-color property.
- Flat Line:
It boasts no blend mixture, unlike Monochrome. Each line is crafted with some help from the LineColor properties.
- Rainbow:
It is pretty comparable to Dichromatic. Nevertheless, the expected results bear nothing similar to any Dichromatic outcome. Why so? It’s because its linear interpolation occurs in HSV spaces. Hence, your effects will take the shape of a rainbow hue.
- Functional:
Both Linecolor2 and LineColor are not to be considered, with a color scheme obtained from the LineColor functions. Given no color functions, Line Color Types will be deemed “Flat” automatically.
3. LineWidth
LineWith falls into the “Line Style” properties, which alter the line’s width and numerous line objects such as arrows, surface parameters, and three-dimensional and two-dimensional curves. Similar to other properties, it is incompatible with axes and grid lines.
Another note is that the width must be numerical values, measured in “mm” length units.
Here are some examples:
Example 1:
x=1:0.1:10;
plot(x, sin(x),"LineWidth",2);
Example 2:
x=1:0.1:10;
plot(x, sin(x),"LineWidth",12);
Conclusion
This article has introduced the most common properties of MatLab LineStyle, which help programmers describe the continuous nature of a programming or mathematical phenomenon. Detailed examples are also given to help you grasp their fundamental concepts! MatLab is simple software, but sometimes, there might still be errors. For common issues (such as the error “Subscript indices must either be real positive integers or logical“), you can always turn to the ITtutoria QA section for more support.
Leave a comment