Illustration of a built-in function, MATLAB Programming

Illustration of a built-in function:

The length function is an illustration of a built-in function which computes a single value; it returns the length of a vector. As an illustration, length (vec) is an expression; it shows the number of elements in the vector vec. This expression can be used in the Command Window or in a script. Usually, the value returned from this expression may be assigned to the variable:

>> vec = 1:3:10;

>> lv = length(vec)

lv =


Alternatively, the length of vector could be printed

>> fprintf('The length of the vector is %d\n', length(vec))

The length of the vector is 4

Posted Date: 10/18/2012 7:12:55 AM | Location : United States

Related Discussions:- Illustration of a built-in function, Assignment Help, Ask Question on Illustration of a built-in function, Get Answer, Expert's Help, Illustration of a built-in function Discussions

Write discussion on Illustration of a built-in function
Your posts are moderated
Related Questions
Create a function using mat lab to generate a sinusoidal signal. The parameters of the signal should have an Amplitude = 100, frequency = 100Hz, initial phase = 0, sample rate = 50

1. Given these sinusoids: x 1 (t) = 0.5cos(25t+20°),   x 2 (t)=0.85cos(25t+160°) and   x 3 (t)= 0.81cos(25t-145°) (a)  Subplot the phasors X 1 , X 2 and X 3 corresponding t

Water flow varies with water pressure. Two studies were made and two equations were developed: Parabolic fit:  F = 59.60180 + 3.77965 P - 0.01536 P 2       P

Reading from a File: A file has been once created; it can be read into a matrix variable. When the file is a data file, the load function will read from the file filename.ext

Hello! How to cipher on Matlab the message consisting eight symbols. At first the message shares on blocks. Then in each of blocks shift of symbols is carried out. The initial text

matlab code for path and adjancy martix between pixels

Illustrations of if statement: illustrations of running this script: >> sqrtifexamp Please enter a number: -4.2 The sqrt of 4.2 is 2.0 >> sqrtifexamp Please ent

Documentation: It is very important that all the scripts be documented well, so that the people can understand what the script does and how it accomplishes that. One way of do

Illustrations of calling the rand function: The function ‘rand’ can be used to produce random real numbers; calling it produces one random real number in the range from 0 to

how to wriet program for batch reactor