Matlab Tutorials | Examples Practice 14: Knight’s Tour (Advance) One of the interesting puzzles for chess buffs is the Knight’s Tour problem, which is attributed to the famous mathematician Euler. The question is this: Can the chess piece called the knight move around an empty chessboard and land in each of the 64 squares once…

# Tag: Matlab Tutorials

## Number of rectangles from unit squares | Matlab Examples

Matlab Tutorials | Examples Practice 13: Number of rectangles from unit squares Assume you are given an m×n rectangle of unit squares. Within this rectangle, many rectangles and squares can be formed by joining the unit squares. Consider the 2×3 rectangle below. There are 18 rectangles (some of them being squares) that you can construct…

## Plotting: Concentrations, curve fitting, 3D Gaussian plot | Matlab Examples

Matlab Tutorials | Examples Practice 12: Plotting: Concentrations, curve fitting, 3D Gaussian plot Create the three plot windows detailed below using the data in the file practice12data.mat. Your plots should match the provided sample outputs. Pay attention to titles, x-y labels, grids, legends and their positions, colours etc. Running your main script should produce all…

## Files: Periodic Table – Electron Configurations | Matlab Examples

Matlab Tutorials | Examples Practice 11: Files: Periodic Table – Electron Configurations You are given a file named “PeriodicTable.txt”. The format of the file is as follows: The third column of this file, electron configuration, gives the arrangement of the electrons in various atomic orbitals around the nucleus. For simplicity, the configuration gives a noble…

## Files: Amino acid bonds | Matlab Examples

Matlab Tutorials | Examples Practice 10: Files: Amino acid bonds Proteins are made up of amino acids. Every amino acid has one amino group (N), one carboxyl group (C) and one chiral carbon (Cα or CA). The angle between CA-C is called “psi” (ψ) and the angle between N-CA is called “phi” (Φ). Phi and…

## Formatted output & structures: Stars and their planets | Matlab Examples

Matlab Tutorials | Examples Practice 9: Formatted output & structures: Stars and their planets MAT files are used for saving MATLAB variables for later use, or for transferring them between computers. You can save your variables into a MAT file by giving the save command. Example: >>save(‘myvariables.mat’); In order to save specific variables (rather than…

## Functions: Dealing with a triangle | Matlab Examples

Matlab Tutorials | Examples Practice 8: Functions: Dealing with a triangle The side lengths of a triangle always satisfy the following conditions: a < b+c b < a+c c < a+b Function get_abc Write a function named get_abc that gets three positive integers inputs (a, b, c) from the user. If either value is negative…

## Arrays-matrices: Island area and perimeter | Matlab Examples

Matlab Tutorials | Examples Practice 7: Arrays-matrices: Island area and perimeter The above figure illustrates an example of a 2D grid map of an island, where land is shown in green and the surrounding sea is shown in blue. This grid map can be represented by an n×n matrix where green squares are 1s and…