Professional Documents
Culture Documents
1
1
1
The sign convention used in MatLabs fft routines are defined as sum(x(i)*exp (j*i*k/N)) and not sum (x(i)exp(j*i*k/N)). The first version is used by engineers, and
the second is used by mathematician.
9) What are the four basic functions to solve Ordinary Differential
Equations (ODE)?
The four basic functions that MatLab has to solve ODEs are
Quad
Quad8
ODE23
ODE45
10) Explain how polynomials can be represented in MatLab?
A polynomial in MatLab is denoted by a vector. To create a polynomial in MatLab
enter each co-efficient of the polynomial into the vector in descending order
11) What is the type of program files that MatLab allows to write?
Matlab allows two types of program files
Scripts: It is a file with .m extension. In these files, it writes series of command that
you want to execute together. It does not accept inputs and do not return any outputs
Functions: They are also files with .m extension. Functions can accept inputs and
return outputs.
12) Explain how to modify the MatLab Path?
To modify the MatLab Path use the PathTool GUI. Also, you can use add path
directories from the command line and add the path to rc to write the current path
back to pathdef.m. In the case if you dont have permission to write for pathdef.m
then pathrc can be written into a different file, you can execute from your startup.m.
13) Explain what is LaTex in MatLab?
MatLab handles naturally simple LaTex encoding which allows introducing greek
letters or modifying the font size and appearance in plots.
MEX files: They are basically native C or C++ files which are linked directly into the
MatLab application at runtime. MEX files have efficiency to crash the MatLab
application.
18) Explain what is Interpolation and Extrapolation in Matlab?
What are their types?
Interpolation: Taking out function values between different data points in an array is
referred as Interpolation
Extrapolation: Finding function values beyond the endpoints in array is referred as
Extrapolation
The two types of Interpolation and Extrapolation are
Linear Interpolation and Extrapolation
Quadratic Interpolation and Extrapolation
19) List out some of the common toolboxes present in Matlab?
Some of the common toolboxes in Matlab are
Control System
Fuzzy Logic
Image Processing
LMI control
Neural Networks
Robust Control
System Identification
20) What is Get and Set in Matlab?
Get and Set are referred as getter and setter functions. For assigning properties,
setter functions are used while for accessing properties getter functions are used.
What are the functions used to read text files from a certain
format in Matlab?
Following functions can be used to read a text file:
DLMREAD: It allows you to read files with fields delimited by any character.
TEXTREAD: It allows you to skip lines at the beginning, ignore certain comment lines,
read text as well as numbers, and more.
myfile.txt: It is for the file which has nothing but numbers separated by space, and has
a constant number of columns through the entire file. Other functions are FOPEN,
FREAD, FSCANF, FGETL, FSEEK and FCLOSE.
What is a P-code?
P-code files are purposely obscured; they offer a secure means of distribution outside of
your organization. Pcode is a preparsed and encoded version of the M-file. It saves on
the load time of the function. This is most likely not an issue except for very large M-files,
since most are parsed only once anyway. Pcode also lets you hide the source code from
others. There is no way to convert Pcode back to the M-file source. Pcode is platform
independent.
obscured form called a P-code file (from its .p file extension), and distribute your
application code in this format.
2. Compile into binary format : Compile your source code files using the MATLAB
Compiler to produce a standalone application. Distribute the latter to end users of your
application.
What is fminsearch?
General fits which are fitted by giving a decent initial guess for fitting parameters in it is
done by fminsearch which is a multidimensional minimizer routine.
Suppose we have a set of data points (xj , yj) and a proposed fitting function of the form
y = f(x, a1, a2, a3, ...).
For example : we could try to fit to an exponential function
With two adjustable parameters a1 and a2 as is done in the example in leastsq.m below:
f(x, a1, a2) = a1ea2x
Or we could fit to a cubic polynomial in x2 with four adjustable parameters a1, a2, a3, a4
with this f:
f(x, a1, a2, a3, a4) = a1 + a2x2 + a3x4 + a4x6
loglog(x,y);
title(Loglog)
How can you change the ratio of the axis in a 3-D plot?
For changing the ratio of the axis in a 3-D plot, you will need to change the xform
property of the current axis. The property transforms the 3-D data to be plotted on the 2D screen.
Following code will work:
function aspect3(x,y,z)
v = get(gca,'xform');
d = diag([x y z 1]);
set(gca,'xform',v*d);
Define Xmath
x=
1
0
ans =
-2.0000
1.5000
12
34
56
78
9 10