Vous êtes sur la page 1sur 75

CONTENT

S.N TOPIC NAME PAGE NO.

1 GENERAL PURPOSE COMMANDS I-XVI

2 MATLAB BASICS 1-12

3 INTRODUTION TO PLOTTING 13-30

4 PROGRAMING IN MATLAB 31-36

5 BASIC ELECTRICAL AND NETWORKS 37-50


APPLICATIONS

6 INTRODUCTION TO SIMULINK 51-58

7
General Purpose Commands

Operators and Special Characters


+ Plus; addition operator.
- Minus; subtraction operator.
* Scalar and matrix multiplication operator.
.* Array multiplication operator.
^ Scalar and matrix exponentiation operator.
.^ Array exponentiation operator.
\ Left-division operator.
/ Right-division operator.
.\ Array left-division operator.
./ Array right-division operator.
: Colon; generates regularly spaced elements and represents an entire row or column.
( ) Parentheses; encloses function arguments and array indices; overrides precedence.
[ ] Brackets; enclosures array elements.
. Decimal point.
Ellipsis; line-continuation operator.
, Comma; separates statements and elements in a row.
; Semicolon; separates columns and suppresses display.
% Percent sign; designates a comment and specifies formatting.
_ Quote sign and transpose operator.
._ Nonconjugated transpose operator.
= Assignment (replacement) operator.

Commands for Managing a Session


clc Clears Command window.
clear Removes variables from memory.
exist Checks for existence of file or variable.
global Declares variables to be global.
help Searches for a help topic.
lookfor Searches help entries for a keyword.
quit Stops MATLAB.
who Lists current variables.
whos Lists current variables (long display).

I
Special Variables and Constants
ans Most recent answer.
eps Accuracy of floating-point precision.
i,j The imaginary unit 1.
Inf Infinity.
NaN Undefined numerical result (not a number).
pi The number .

System and File Commands


cd Changes current directory.
date Displays current date.
delete Deletes a file.
diary Switches on/off diary file recording.
dir Lists all files in current directory.
load Loads workspace variables from a file.
path Displays search path.
pwd Displays current directory.
save Saves workspace variables in a file.
type Displays contents of a file.
what Lists all MATLAB files in the current directory.
wklread Reads .wk1 spreadsheet file.

II
Input/Output and Formatting Commands

Input/Output Commands
disp Displays contents of an array or string.
fscanf Read formatted data from a file.
format Controls screen-display format.
fprintf Performs formatted writes to screen or file.
input Displays prompts and waits for input.
; Suppresses screen printing.

Format Codes for fprintf and fscanf

%s Format as a string.
%d Format as an integer.
%f Format as a floating point value.
%e Format as a floating point value in scientific notation.
%g Format in the most compact form: %f or %e.
\n Insert a new line in the output string.
\t Insert a tab in the output string.

Numeric Display Formats


format short Four decimal digits (default).
format long 16 decimal digits.
format short e Five digits plus exponent.
format long e 16 digits plus exponents.
format bank Two decimal digits.
format + Positive, negative, or zero.
format rat Rational approximation.
format compact Suppresses some line feeds.
format loose Resets to less compact display mode.

III
Vector, Matrix and Array Commands

Array Commands
cat Concatenates arrays.
find Finds indices of nonzero elements.
length Computers number of elements.
linspace Creates regularly spaced vector.
logspace Creates logarithmically spaced vector.
max Returns largest element.
min Returns smallest element.
prod Product of each column.
reshape Change size
size Computes array size.
sort Sorts each column.
sum Sums each column.

Special Matrices
eye Creates an identity matrix.
ones Creates an array of ones.
zeros Creates an array of zeros.

Matrix Arithmetic
cross Computes cross products.
dot Computes dot products.

Matrix Commands for Solving Linear Equations


det Computes determinant of an array.
inv Computes inverse of a matrix.
pinv Computes pseudoinverse of a matrix.
rank Computes rank of a matrix.
rref Computes reduced row echelon form.

IV
Cell Array Functions
cell Creates cell array.
celldisp Displays cell array.
cellplot Displays graphical representation of cell array.
num2cell Converts numeric array to cell array.
deal Matches input and output lists.
iscell Identifies cell array.

Structure Functions
fieldnames Returns field names in a structure array.
getfield Returns field contents of a structure array.
isfield Identifies a structure array field.
isstruct Identifies a structure array.
rmfield Removes a field from a structure array.
setfield Sets contents of field.
struct Creates structure array.

V
Plotting Commands

Basic xy Plotting Commands


axis Sets axis limits.
fplot Intelligent plotting of functions.
grid Displays gridlines.
plot Generates xy plot.
print Prints plot or saves plot to a file
title Puts text at top of plot.
xlabel Adds text label to x-axis.
ylabel Adds text label to y-axis.

Plot Enhancement Commands


axes Creates axes objects.
close Closes the current plot.
close all Closes all plots.
figure Opens a new figure window.
gtext Enables label placement by mouse.
hold Freezes current plot.
legend Legend placement by mouse.
refresh Redraws current figure window.
set Specifies properties of objects such as axes.
subplot Creates plots in subwindows.
text Places string in figure.

Specialized Plot Commands


bar Creates bar chart.
loglog Creates log-log plot.
polar Creates polar plot.
semilogx Creates semilog plot (logarithmic abscissa).
semilogy Creates semilog plot (logarithmic ordinate).
stairs Creates stairs pot.
stem Creates stem plot.

VI
Colors, Symbols and Line Types

Color Symbol Line


y yellow . point - solid
m magenta o circle : dotted
c cyan x x-mark -. dash dotted
r red + plus -- dashed
g green * star
b blue d diamond
w white v triangle (down)
k black ^ triangle (up)
< triangle (left)
> triangle (right)
p pentagram
h hexagram

Three-Dimensional Plotting Commands


contour Creates contour plot.
mesh Creates three-dimensional mesh surface plot.
meshc Same as mesh with contour plot underneath.
meshz Same as mesh with vertical lines underneath.
plot3 Creates three-dimensional plots from lines and points.
surf Creates shaded three-dimensional mesh surface plot.
surfc Same as surf with contour plot underneath.
meshgrid Creates rectangular grid.
waterfall Same as mesh with mesh lines in one direction.
zlabel Adds text label to z-axis.

Histogram Functions
bar Creates a bar chart.
hist Aggregates the data into equally spaced bins.
histc Aggregates the data into unequally spaced bins.

VII
Programming

Logical and Relational Operators


== Relational operator: equal to.
~= Relational operator: not equal to.
< Relational operator: less than.
<= Relational operator: less than or equal to.
> Relational operator: greater than.
>= Relational operator: greater than or equal to.
& Logical operator: AND.
| Logical operator: OR.
~ Logical operator: NOT.
xor Logical operator: EXCLUSIVE OR.

Program Flow Control


break Terminates execution of a loop.
case Provides alternate execution paths within switch structure.
else Delineates alternate block of statements.
elseif Conditionally executes statements.
end Terminates for, while, and if statements.
error Display error messages.
for Repeats statements a specific number of times
if Executes statements conditionally.
otherwise Default part of switch statement.
return Return to the invoking function.
switch Directs program execution by comparing point with case expressions.
warning Display a warning message.
while Repeats statements an indefinite number of times.

Logical Functions
any True if any elements are nonzero.
all True if all elements are nonzero.
find Finds indices of nonzero elements.
finite True if elements are finite.
isnan True if elements are undefined.
isinf True if elements are infinite.
isempty True if matrix is empty.
isreal True if all elements are real.

VIII
M-Files
eval Interpret strings containing Matlab expressions.
feval Function evaluation.
function Creates a user-defined function M-file.
global Define global variables.
nargin Number of function input arguments.
nargout Number of function output arguments.
script Script M-files

Timing
cputime CPU time in seconds.
clock Current date and time as date vector.
tic, toc Start, stop a stopwatch timer.

IX
Mathematical Functions

Exponential and Logarithmic Functions


exp(x) Exponential; ex.
log(x) Natural logarithm; ln(x).
log10(x) Common (base 10) logarithm; log(x)= log10(x).
sqrt(x) Square root; x.

Trigonometric Functions
acos(x) Inverse cosine; arcos x = cos 1 (x).
acot(x) Inverse cotangent; arccot x = cot 1(x).
acsc(x) Inverse cosecant; arcs x = csc 1 (x).
asec(x) Inverse secant; arcsec x = sec 1 (x).
asin(x) Inverse sine; arcsin x = sin 1 (x).
atan(x) Inverse tangent; arctan x = tan 1 (x).
atan2(y,x) Four-quadrant inverse tangent.
cos(x) Cosine; cos(x).
cot(x) Cotangent; cot(x).
csc(x) Cosecant; csc(x).
sec(x) Secant; sec(x).
sin(x) Sine; sin(x).
tan(x) Tangent; tan(x).

Hyperbolic Functions
acosh(x) Inverse hyperbolic cosine; cosh 1 (x).
acoth(x) Inverse hyperbolic cotangent; coth 1 (x).
acsch(x) Inverse hyperbolic cosecant; csch 1 (x).
asech(x) Inverse hyperbolic secant; sech 1 (x).
asinh(x) Inverse hyperbolic sine; sinh 1 (x).
atanh(x) Inverse hyperbolic tangent; tanh 1 (x).
cosh(x) Hyperbolic cosine; cosh(x).
coth(x) Hyperbolic cotangent; cosh(x)/sinh(x).
csch(x) Hyperbolic cosecant; 1/sinh(x).
sech(x) Hyperbolic secant; 1/cosh(x).
sinh(x) Hyperbolic sine; sinh(x).
tanh(x) Hyperbolic tangent; sinh(x)/cosh(x).

X
Complex Functions
abs(x) Absolute value; |x|.
angle(x) Angle of a complex number x.
conj(x) Complex conjugate of x.
imag(x) Imaginary part of a complex number x.
real(x) Real part of a complex number x.

Statistical Functions
erf(x) Computes the error function erf (x).
mean Calculates the average.
median Calculates the median.
std Calculates the standard deviation.

Random Number Functions


rand Generates uniformly distributed random numbers between 0 and 1.
randn Generates normally distributed random numbers.

Numeric Functions
ceil Rounds to the nearest integer toward .
fix Rounds to the nearest integer toward zero.
floor Rounds to the nearest integer toward - .
round Rounds towards the nearest integer.
sign Signum function.

String Functions
findstr Finds occurrences of a string.
strcmp Compares strings.
char Creates character string array

XII
Numerical Methods

Polynomial and Regression Functions


conv Computes product of two polynomials
deconv Computes ratio of polynomials.
eig Computes the eigenvalues of a matrix.
poly Computes polynomial from roots.
polyfit Fits a polynomial to data.
polyval Evaluates polynomial and generates error estimates.
roots Computes polynomial roots.

Interpolation Functions
interp1 Linear and cubic-spline interpolations of a function of one variable.
interp2 Linear interpolation of a function of two variables.
spline Cubic-spline interpolation.
unmkpp Computes the coefficients of cubic-spine polynomials.

Root Finding and Minimization


fmin Finds minimum of single-variable function.
fmins Finds minimum of multivariable function.
fzero Finds zero of single-variable function.

Numerical Integration Functions


quad Numerical integration with adaptive Simpsons rule.
quadl Numerical integration with adaptive Lobatto quadrature.
trapz Numerical integration with the trapezoidal rule.

Numerical Differentiation Functions


diff(x) Computes the difference between adjacent elements in the vector x.
polyder Differentiates a polynomial, a polynomial product, or a polynomial quotient.

XIII
ODE Solvers
ode23 Nonstiff, low-order solver.
ode45 Nonstiff, medium-order solver.
ode113 Nonstiff, variable-order solver.
ode23s Stiff, low-order.
ode23t Moderately stiff, trapezoidal rule solver.
ode23b Stiff, low-order solver.
ode15s Stiff, variable-order solver.
odeset Creates integrator options structure for ODE solvers.

Predefined Input Functions


gensig Generates a periodic sine, square, or pulse input.
sawtooth Generates a periodic sawtooth input.
square Generates a square wave input.
stepfun Generates a step function input.

XIV
Symbolic Math Toolbox

Functions for Creating and Evaluating Symbolic Expressions


class Returns the class of an expression.
digits Sets the number of decimal digits used to do variable precision arithmetic.
double Converts an expression to numeric form.
ezplot Generates a plot of a symbolic expression.
findsym Finds the symbolic variables in a symbolic expression.
numden Returns the numerator and denominator of an expression.
sym Creates a symbolic variable.
syms Creates one or more symbolic variables.
vpa Sets the number of digits used to evaluate expressions.

Functions for Manipulating Symbolic Expressions


collect Collects coefficients of like powers in an expression.
expand Expands an expression by carrying out jpowers.
factor Factors an expression.
poly2sym Converts a polynomial coefficient vector to a symbolic polynomial.
pretty Displays an expression in a form that resembles typeset mathematics.
simple Searches for the shortest form of an expression.
simplify Simplifies an expression using Maples simplification rules.
subs Substitutes variables or expressions.
sym2poly Converts an expression to a polynomial coefficient vector.

Symbolic Calculus Functions


diff Returns the derivative of an expression.
Dirac Dirac delta function (unit impulse).
Heaviside Heaviside function (unit step).
int Returns the integral of an expression.
limit Returns the limit of an expression.
symsum Returns the symbolic summation of an expression.
taylor Returns the Taylor series of a function.

XV
Symbolic Solution of Algebraic and Transcendental Equations
solve Solves symbolic equations.

Symbolic Solution of Differential Equations


dsolve Returns a symbolic solution of a differential equation or set of equations.

Laplace Transform Functions


ilaplace Returns the inverse Laplace transform.
laplace Returns the Laplace transform.

Symbolic Linear Algebra Functions


det Returns the determinant of a matrix.
eig Returns the eigenvalues (characteristic roots) of a matrix.
inv Returns the inverse of a matrix.
poly Returns the characteristic polynomial of a matrix.

XVI
CHAPTER-1
MATLAB BASICS
Ex-1.1
Use of if constructs

A salesman is paid his normal wage up to 40 hours a week. He is paid overtime 30% more for next
10 hours and 50% after that. Write a program to calculate his salary. Prompt the user to enter the
number of hours and hourly wages.

Solution
The M-file developed is shown below:

%programe to clculate the salary


H=input('Enter the number of hours worked');
R=input('Enter the hourly wage in Rs.');
if H<=40
salary=H*R
elseif H>40 &H<=50
salary=R*40+(H-40)*(R+0.3*R);
else
salary=(R*40)+10*(R+0.3*R)+(H-50)*(R+0.5*R);
end
fprintf('The salary is Rs%5.2f',salary)

Output
Enter the number of hours worked20
Enter the hourly wage in Rs.50
salary =

1000

The salary is Rs1000.00>>

Ex-1.2
Write a program to find the sum of even number between 0 and 20 using for loop.

Solution
sThe M-file given below shows the use of for loop to find sum of even number between 0 and 20.
%programe to use for loop
sum=0;
for j=0:2:20
sum=sum+j;
end;
sum

1
Output
sum =

110

Ex-1.3
Write a program to generate sinusoidal waveform.

Solution
The MATLAB program to generate a sinusoidal voltage and current (lag by 90o w.r.t voltage)
waveform using for loop is given below.
%plot sine wave using for loop
f=50; n=1;
w=2*pi*f;
for t=0:1e-3:0.04;
v=sin(w*t);
i=sin(w*t-pi/2);
xt(n)=t ;xv(n)=v ; xi(n)=i;
n=n+1;
end
plot(xt,xv,': g d',xt,xi,'-- r *');
grid;
title('plot sine wave using for loop ')
xlabel('time(sec)');
ylabel('voltage &current');

Output

2
Ex-1.4

Write a program to generate to find the sum of even numbers between 0 and 21 using a while loop.

Solution
The MATLAB program given below show the use of while loop to find sum of even numbers between
0and 21.
%while loop programe
n=0;
sum=0;
while n<21
sum=sum+n;
n=n+2;
end;
sum

Output
sum =

110

Ex-1.5
Enter the following arrays and check their size using who command.
a=[10 20i 10+20]
b=[-1;10;5]
c=[a' b]
d=[1 2 3;2 -2 0; 3 0 4]
e(3,3)=2
p=[zeros(3,1) ones(3,1) zeros(1,3)']

Solution
The M-file developed is shown below:

a=[10 20i 10+20]


b=[-1;10;5]
c=[a' b]
d=[1 2 3;2 -2 0; 3 0 4]
e(3,3)=2
p=[zeros(3,1) ones(3,1) zeros(1,3)']
size(a)
size(b)
size(c)
size(d)
size(e)
size(p)

3
Output

ans =

1 3

ans =

3 1

ans =

3 2

ans =

3 3

ans =

3 3

ans =

3 3

Ex-1.6
Find the value of a a(1,2),b(3,1),c(2,2) in the Ex-5 problem.

Solution
The M-file developed is shown below:

A=a(1,2)
B=b(3,1)
C=c(2,2)

Output

A=

0.0000 +20.0000i

4
B=

C=

10

Ex-1.7
An array A is defined as given below:
A=[1.1 0.3 2.1 2.2; 0.2 1.2 -0.6 -1; 1.3 4.5 3 3.1]

Determine the following sub-arrays


(1) A(1,:)
(2) A(:,end)
(3) A(2:end)
(4) A(1:2,2:4)
(5) A(1:2,3:end)
(6) A(5)
(7) A(1:2,2:2)

Solution
The M-file developed is shown below:

A=[1.1 0.3 2.1 2.2;0.2 1.2 -0.6 -1;1.3 4.5 3 3.1];


a=A(1,:)
b=A(:,end)
c=A(2:end)
d=A(1:2,2:4)
e=A(1:2,3:end)
f=A(5)
g=A(1:2,2:2)

Output

a=

1.1000 0.3000 2.1000 2.2000

b=

2.2000

5
-1.0000
3.1000

c=
0.2000 1.3000 0.3000 1.2000 4.5000 2.1000 -0.6000 3.0000 2.2000 -1.0000
3.1000

d=

0.3000 2.1000 2.2000


1.2000 -0.6000 -1.0000

e=

2.1000 2.2000
-0.6000 -1.0000

f=

1.2000

g=

0.3000
1.2000

Ex-1.8
Solve the following problem in the command window:
x=(25*32.5-4^3)/(31+5^2)
y=3*(3+5^2)/4+(124*3+2)/3-55^2/3
p=(sin(7*pi/3))^2*cos(5*pi/2)+tan(3*pi/2)/(13/2)
q=(325)^(1/3)/7^2*log(25)/(23+5^3)+(1025)^(1/4)

Solution
The M-file developed is shown below:

x=(25*32.5-4^3)/(31+5^2)
y=3*(3+5^2)/4+(124*3+2)/3-55^2/3
p=(sin(7*pi/3))^2*cos(5*pi/2)+tan(3*pi/2)/(13/2)
q=(325)^(1/3)/7^2*log(25)/(23+5^3)+(1025)^(1/4)

6
Output

x=

13.3661
y=

-862.6667

p=

8.3750e+14

q=

5.6613

Ex-1.9
Evaluate the following for x=2.3 and y=4.7:
z=x*y^3+x^5/(y-3547)+(x^3*y^5/(x/y))

Solution

The M-file developed is shown below:

x=2.3; y=4.7;
z=x*y^3+x^5/(y-3547)+(x^3*y^5/(x/y))
Output

z=

5.7261e+04

Ex-1.10
Create a row vector with first and last element as 50 and -50 with a decrement of 5.(A column vector
can be created by transpose of a row vector.)

Solution
The M-file developed is shown below:

y=(50:-5:-50)
X=(1:2:100)
transpose(y)

7
Output

ans =

50
45
40
35
30
25
20
15
10
5
0
-5
-10
-15
-20
-25
-30
-35
-40
-45
-50

Ex-1.11
Create a matrix
A=[5 15 25 35; 39 29 19 9; 42 45 48 51]
Use this matrix to create
(a) A four-element row vector containing the element of first row.
(b) A three element of row vector containing the element of fourth column.
(c) A six element row vector containing the element of first and second columns.
(d) An eight element row vector containing the element of first and second rows.

Solution
The M-file developed is shown below:

A=[5 15 25 35;39 29 19 9;42 45 48 51];


a=A(1,:)
b=A(:,4)
c=[A(1,1) A(2,1) A(3,1) A(1,2) A(2,2) A(3,2)]
d=[A(1,1) A(1,2) A(1,3) A(1,4) A(2,1) A(2,2) A(2,3) A(2,4)]

8
Output

a=

5 15 25 35

b=

35
9
51

c=

5 39 42 15 29 45

d=

5 15 25 35 39 29 19 9

Ex-1.12
Create a matrix
A=[5 15 25 30 35; 7 17 27 37 27; 39 29 19 42 9; 42 45 48 47 51]
Use this matrix to create
(a) A four-element column vector containing the elements of first column vector containing the
elements of first column.
(b) A three-element column vector containing the elements of fourth column.
(c) An eight element column vector containing the elements of first and second columns.
(d) A 10-element column vector containing the elements of first and second rows.

Solution
The M-file developed is shown below:

A=[5 15 25 30 35;7 17 27 37 27;39 29 19 42 9;42 45 48 47 51];


a=A(:,1)
b=A(1:3,4)
c=A(:,1:2)
d=A(1:2,:)

9
Output

a=

5
7
39
42

b=

30
37
42

c=

5 15
7 17
39 29
42 45

d=

5 15 25 30 35
7 17 27 37 27

Ex-1.13
Using the zeros and ones commands create a 3x5 matrix having second and fourth columns as 0s and
first ,third and fifth columns as 1s.

Solution
The M-file developed is shown below:

A=zeros(3,5)
B=ones(3,5)
C=A+B
C(:,2)=0
C(:,4)=0

10
Output

A=

0 0 0 0 0
0 0 0 0 0
0 0 0 0 0

B=

1 1 1 1 1
1 1 1 1 1
1 1 1 1 1

C=

1 1 1 1 1
1 1 1 1 1
1 1 1 1 1

C=

1 0 1 1 1
1 0 1 1 1
1 0 1 1 1

C=

1 0 1 0 1
1 0 1 0 1
1 0 1 0 1

Ex-1.14
Calculate the value of x for the following function x=(y^2+2)^2*y^2 for the value of y varying from -
4 to 4 with an increment of 0.5. Solve the problem by creating a vector of y.

11
Solution
The M-file developed is shown below:

y=-4:0.5:4 % create vector


x=(y.^2+2).^2.*y.^2

Output

y=

Columns 1 through 12

-4.0000 -3.5000 -3.0000 -2.5000 -2.0000 -1.5000 -1.0000 -0.5000 0 0.5000 1.0000
1.5000

Columns 13 through 17

2.0000 2.5000 3.0000 3.5000 4.0000

x=

1.0e+03 *

Columns 1 through 12

5.1840 2.4875 1.0890 0.4254 0.1440 0.0406 0.0090 0.0013 0 0.0013 0.0090
0.0406

Columns 13 through 17

0.1440 0.4254 1.0890 2.4875 5.1840

12
CHAPTER-2
INTRODUTION TO PLOTTING
Ex-2.1
Plot the voltage (v=5sinwt) and current(i=2sin(wt-)) flowing through a circuit on the common axis.

Solution
To plot the voltage and current flowing through a circuit on the common axis ,two different vectors ,v
and i are to be created as a function of time t. Then to plot both the function on a common time axis.

The M-file developed is shown below:

%multiple plot using plot command


t=0:1e-3:0.04;
f=50;
w=2*pi*f;
v=5*sin(w*t);
i=2*sin(w*t-pi/3);
figure(2);
plot(t,v,'-- gd',t,i,'-r*')
title('multiple plot using plot command');
xlabel('Time(sec)')
ylabel('voltage & current');
grid on;

Output

Fig-1

13
Ex-2.2
Use the hold command to obtain a multiple plot. Use the gtext command to add the text v1 and v2 to
the plots

Solution
The following program illustrates the use of the hold on command to generate multiple plots.

The M-file developed is shown below:

%multiple plot using hold command


f=50; w=2*pi*f;
t=0:1e-3:0.04;
x=w*t;
y=sin(x);
figure(1);
plot(t,y,'g --');
hold on;
gtext('y=sin(x)');
y1=cos(x);
plot(t,y1,'r -');
hold off;
gtext('y1=cos(x)');
title('Multipe plot using hold command');
xlabel('time(sec)');
ylabel('y&y1')
grid on;

Output

Fig-2

14
Ex-2.3
Use the line command to generate a multiple plot.

Solution
The following program illustrates the use of line command to create multiple plots. The plot of t
versus v1 is obtained using plot command with dashed line style ,whereas the plot of t versus v2 is
obtained using line command.

The M-file developed is shown below:

%multiple plot using line command


%supply line arguments
t=0:1e-3:0.04;
f=50;
w=2*pi*f;
v1=sin(w*t);
v2=cos(w*t);
plot(t,v1);
gtext('v1');
line(t,v2);
gtext('v2');
title('multiple plot using line command');
xlabel('Time (sec)');
ylabel('v1 & v2')
grid on;

Output

Fig-3

15
Ex-2.4
Plot the function [y=3(-0.2x+10) -5] for a value of x from 0.1 to 60 on linear ,semilog, and loglog axis.

Solution
The M-file developed is shown below:

%logrithmic plot of a function in subplot


x=linspace(0.1,60,500);
y=3.^(-0.2*x+10)-5;
subplot(2,2,1);
plot(x,y ,'g * ');
title('plot(x,y)');
xlabel('linear');
ylabel('linear');grid;
subplot(2,2,2);
semilogx(x,y,'r');
title('semilogx(x,y');
xlabel('linear');
ylabel('linear'); grid;
subplot(2,2,3);
semilogy(x,y ,'y - o');
title('semilogy(x,y)');
xlabel('linear');
ylabel('linear');grid;
subplot(2,2,4);
loglog(x,y ,'m d');
title('loglog(x,y)');
xlabel('linear');
ylabel('linear');grid;

Output

Fig-4

16
Ex-2.5
Plot the complex function x(t)=e-0.2t ( sint + j cost) for (0 ).

Solution
A complex function variable can be plotted in three different ways:

1.Plot of both real and imaginary parts w.r.t time.

2.Plot of real part versus imaginary part.

3.polar plot.

The M-file developed is shown below:

%plot of complex function


t=0:pi/20:2*pi;
x=exp(-0.2*t).*(sin(t)+j*cos(t));
figure(1);
plot(t,real(x),'- r');
hold on;
plot(t,imag(x),'-- g');
title ('plot of complex data versus time');
xlabel('time');
ylabel('x(t)');
legend('real','imagnary');
hold off;
grid on;
%real versus imagnary
figure(2);
plot(x);
title('plot of complex data')
xlabel('real part')
ylabel('imagnary part');
grid on;
%ploar plot
figure(3);
polar(angle(x),abs(x));
title('plot of complex data as polar plot');

17
Output

Fig-5

Fig-6

Fig-7

18
Ex-2.6
Represent the year wise placement data of an educational institute described below using vertical and
horizontal bar plot, stairs and stem plot.

Year 2001 2002 2003 2004 2005 2006


Placement 90 120 100 80 110 130
(Numbers)
Solution
The bar , barh, stairs ,and stem command are used to plot the given year-wise placement data.
The M-file developed is shown below:
%vertical bar polt
%year=y, %placement=p
y=(2001:1:2006);
p=[90 120 100 80 110 130];
figure(1);
bar(y,p, 'g');
title('vertical bar polt');
xlabel('year');
ylabel('placment(Nos)');
%horizantal bar poot
figure(2);
barh(y,p,'r');
xlabel(' placment(Nos)');
ylabel('year');
%stairs plot
figure(3);
stairs(y,p ,'b');
xlabel('year');
ylabel('placment(Nos)');

Output

Fig-8

19
Fig-9

Fig-10

Ex-2.7
Represent the grades assigned to a class using pie chart.

No. students 10 20 15 10 5
Grade A B C D E
Solution
The vector A is created to represent the number of students. Legend one, two, three, four, and five are
added to represent the grades A,B,C,D, and E respectively. MATLAB plots different sections of pie
chart with different default colours. Text shown is added using plot Editor.
%pie chart
A=[10 20 15 10 5];
figure(1);
pie(A);
title('PIE CHART');

20
legend('one','two','three','four','five');
%pie chart with explod
figure(2);
explode=[0,1,0,1,0];
pie(A,explode);
title('No of students with max & min grades');
legend('one','two','three','four','five');

Output

Fig-11

Fig-12

Ex-2.8
Plot the function f(x)=0.2x+sin(2x)/x directly using ezplot and fplot command.

Solution
The plot obtained using ezplot with default limits. Using fplot command with only x-axis limits.
The plot fixes the y-axis limits automatically. Hera also plot obtained using fplot command with
defined x-axis and y-axis limit.
The M-file developed is shown below:
%programe to ploy function directly
figure(1);
ezplot('0.2*x+sin(2*x)/x');
title('plot of f(x)=0.2*x+sin(2*x)/x');
grid on;
figure(2);
fplot('0.2*x+sin(2*x)/x',[-2*pi 2*pi]);

21
title('plot of f(x)=0.2*x+sin(2*x)/x using fplot' );
grid on;
figure(3)
fplot('0.2*x+sin(2*x)/x',[-2*pi 2*pi -pi pi]);
title('plot of f(x)=0.2*x+sin(2*x)/x using fplot' );
grid on;

Output

Fig-13

Fig-14

Fig-15

22
Ex-2.9
Plot the decaying oscillations of a mechanical system which can be represented as a function of
independent variable time t=0 using 2-D and 3-D plots.

Solution
A 2-D plot between two variable x and y or plot between (x,t) and (y,t) plotted using plot command.
3-D plot two variable x and y with respect to time.

The M-file developed is shown below:


%2-D plots of decaying oscillations of a mechanical system using
%plot command
t=0:0.1:10;
x=sqrt(t).*cos(2*t);
y=sqrt(t).*sin(2*t);
figure(1);
plot(x,y);
title('2-D plot x versus y');
xlabel('x');
ylabel('y');
grid on;
% plot graph x,y versus t
figure(2);
plot(t,x,'r --');
hold on;
gtext('x');
plot(t,y,'g -')
gtext('y')
title('2-D plot of x and y versus t');
xlabel('t');
ylabel('x and y');
hold off;
grid on;
%3-D plot of decaying of mechanical system using plot 3 command
figure(3);
plot3(x,y,t);
grid on;
title('\bf 3-D plot');
xlabel('x');
ylabel('y');
zlabel('Time');

23
Output

Fig-16

Fig-17

Fig-18

24
Ex-2.10
Plot the function

Z=X2Y/(X2+Y2)+Y

Over the domain -1 and -1 using mesh and surface plot.

Solution
The mesh plot is made of the lines whereas in the surface plot area within the mesh lines are colored.

The M-file developped is shown below:


%ploting a function using mesh and surface plot
x=-1:2;
y=-1:3;
[X,Y]=meshgrid(x,y);
Z=((X.^2.*Y)./(X.^2+Y.^2))+Y;
figure(1);
mesh(X,Y,Z);
grid on;
xlabel('x');
ylabel('y');
zlabel('z');
figure(2);
surface(X,Y,Z);
view(3);
xlabel('x');
ylabel('y');
zlabel('z');

Output

25
Fig-19

Fig-20

Ex-2.11
Plot the function

Z=1.2-0.5(X^2+Y^2)^(1/2) sin(X) cos(0.8Y)

Over the domain x=-3 and y=-3 using mesh,contour,surface,bar,stem .

Solution
The M-file developed is shown below:
%additional 3-Dplots
x=-3:0.25:3;
y=-3:0.25:3;
[X,Y]=meshgrid(x,y);
Z=(1.2.^(-0.5).*sqrt(X.^2+Y.^2)).*sin(X).*cos(0.8*Y);
figure(1);
meshz(X,Y,Z);
title('Meshz plot');
xlabel('x');
ylabel('y');
zlabel('z');

26
%mesh and contour plot
figure(2);
meshc(X,Y,Z);
xlabel('x');
ylabel('y');
zlabel('z');
title('meshcplot')
%surface and contour plot
figure(3);
surfc(X,Y,Z);
xlabel('x');
ylabel('y');
zlabel('z');
title('surfc plot');
%3-D contour plot
figure(4);
contour3(X,Y,Z,20);
xlabel('x');
ylabel('y');
zlabel('z');
title('3-D contour plot');
%2-D contour plot
figure(5);
contour(X,Y,Z,20);
xlabel('x');
ylabel('y');
zlabel('z');
title('2-D contour plot');
%3-D bar plot
figure(6);
bar3(Z);
xlabel('x');
ylabel('y');
zlabel('z');
title('3-D bar plot');

27
Output

Fig-21

Fig-22

28
Fig-23

Fig-24

29
Fig-25

Fig-27

30
CHAPTER-3
PROGRAMING IN MATLAB
Ex-3.1
Write a program to generate at least two cycle of three phase 50Hz,230V line to neutral and line to
line sinusoidal voltage waveform.
Solution
The instantaneous three-phase sinusoidal voltage waveforms can be represented mathematically
As follows:
Line-to-neutral voltage
Van=Vmsinwt
Vbn=Vmsin(wt-2/3)
Vcn=Vmsin(wt+2/3)
Line to-line voltage
Vab=( Van -Vbn)= Vmsin(wt+/6)
Vbc=( Vbn -Vcn)= Vmsin(wt-/2)
Vca=( Vcn -Van)= Vmsin(wt+5/6)
Where Vm= Van and w=2f
The M-file developed is shown below:
%define line to neutral voltage or phase voltage
vm=220;f=50; w=2*pi*f;
t=0:1e-3:0.04; x=w*t;
van=vm*sin(w*t);
vbn=vm*sin(w*t-(2*pi/3));
vcn=vm*sin(w*t+(2*pi/3));
figure(1);
plot(x,van,x,vbn,x,vcn)
legend('van','vbn','vcn')
title('3-phase wave form')
xlabel('angle(wt')
ylabel('phase voltage')
grid on
%define line to line voltge
vab=van-vbn;
vbc=vbn-vcn;
vca=vcn-van;
figure(2);
plot(x,vab,x,vbc,x,vca);
legend('vab','vbc','vca')
title('3-phase line voltage wave form')
xlabel('angle(wt)')
ylabel('line voltage')
grid on
%subplot graph
figure(3)
subplot(2,1,1);

31
plot(x,van,x,vbn,x,vcn)
legend('van','vbn','vcn')
title('3-phase wave form')
xlabel('angle(wt)')
ylabel('line voltage')
grid on;
subplot(2,1,2)
plot(x,vab,x,vbc,x,vca);
legend('vab','vbc','vca')
title('3-phase line voltage wave form')
xlabel('angle(wt)')
ylabel('line voltage')
grid on;

Output

Fig-1

Fig-2

32
Fig-3
Ex-3.2
Write the program to solve the function
f(y)=y3 /(y3+1)2
by writing a function file with name fun_3_2,with the input to the function is y and output f(y)
for following values of y:
(a) f(y)for y=52

Solution
The script and function file for the Ex-3.2 are shown below. The function named is fu_3_2 is saved in
the workspace directory with file name fun_5_2.m. The main file ask for vth einput variable y on
execution.
The M-file developed is shown below:
%function file in different scrit
function [ x] = fun_3_2(y )
%function definition line
%function to solve f(y) for given vlaue of y
%define x=f(y)
x=(y.^3.*sqrt(2*y+4))./(y.^3+1).^2;
end

%main file scrit

%programe to solve y(x)using function approach


y=input('enter the value of y: ');
x=fun_3_2(y)
disp(x)

33
Output
enter the value of y: 52

x=

7.3909e-05

7.3909e-05

Ex-3.3
Write a program to find the sum of integers between two given numbers using function approach.

Solution
The script and function file for the Ex-3.2 are shown below. The use is prompted to enter the range of
number p and q in the script file. A for loop used in the function file to calculate the sum of integers
between the given numbers.
%function file in different scrit

function [sum] = fun_3_3(p,q)


%function definition line
%function to calculate sum of numbers between a given range
sum=0;
for x= p+1:1:q-1
sum=sum+x;
end;

end
%main file scrit
%programefor the addition of integer numbers between two given numbers
%using function approach
p=input('enter the first number p: ');
q=input('enter the second number q: ');
s=input('enter the third number s: ');
%call function
result= fun_3_3(p,q);
%disp result
fprintf ('the sum of integer nubers between %d and %d is %d/n',p,q,result);

Output
example_3_3
enter the first number p: 0
enter the second number q: 5
enter the third number s: 2
the sum of integer nubers between 0 and 5 is 10

34
Ex-3.4
Write a program to find the step response of a series RL circuit shown in fig-4 plot current response

Fig-4
Solution
The mathematical expression to find the current flowing through the circuit for the problem can be
written by applying Kirchhoffs Voltage law as follow:
V=iR+Ldi/dt
This is a first order differential equation and can be rearranged in standard form as
di/dt= 1/L(V-iR)
File name- fun_RL_series
%function file in different scrit
function idot=fun_RL_series(t,i)
%function defination line
global R L V
idot=(1/L)*(V-i*R);

%main file scrit


%problem to plot step response of series RL circuit
global R L V
R=2;
L=100e-3;
V=10;
[t,i]=ode45('fun_RL_series',[0:0.01:1],1);
plot(t,i);
grid on;
xlabel('time(sec)');
ylabel('current(A)');

35
Output

Fig-5

36
CHAPTER-4
BASIC ELECTRICAL AND NETWORKS APPLICATIONS

Ex-4.1
Find the voltage across the capacitor in the network shown in fig-1

Fig-1
Solution
Here numbers of nodes =4 and numbers of loops =3. This problem can be easily solved by writing the
generalized equation directly in the matrix from either using mesh analysis
[Z] [I]=[V] . This method required three equations.
Vc=(I2-I3)(-j3)
The mesh equation in the matrix form can be written as:

[ ] [ ]= [ ]

The M-file developed is shown below:


%solve electrical network figure 6.10
Z1=2+j*4; Z2=5; Z3=2+j*5; Z4=3;Z5=-j*3; Z6=2+j*1;
V=[12;0;0]
Z=[Z1+Z2+Z3 -Z2 -Z3; -Z2 Z2+Z4+Z5 -Z5; -Z3 -Z5 Z3+Z5+Z6]
I=inv(Z)*V
Vc=(I(2)-I(3))*Z5
[Vcm,r]=cart2pol(real(Vc),imag(Vc))

Output
V=

12
0
0

37
Z=

9.0000 + 9.0000i -5.0000 + 0.0000i -2.0000 - 5.0000i


-5.0000 + 0.0000i 8.0000 - 3.0000i 0.0000 + 3.0000i
-2.0000 - 5.0000i 0.0000 + 3.0000i 4.0000 + 3.0000i

I=

1.1663 - 1.1461i
0.8326 - 0.7921i
1.0348 - 0.5157i

Vc =

-0.8292 + 0.6067i

Vcm =

2.5099

r=

1.0275

Ex-4.2
Validation of Maximum power Transfer Theorem.
The Thevenin equivalent circuit of a network show in fig-2. Calculate the output power supplied for
the following load resistances : RL=5 ,10 ,25 ,50 ,50 ,100 ,250 ,500. Plot the graph of
load voltage ,load current and load power for different values of load resistances.

Fig-2

38
Solution
Load current can be obtained as:
IL=
Power input:
Pin=Vth*IL
Power output
PL=VL*IL
Efficiency of the network:

Efficiency =
The M-file developed is shown below:
%programe to validate maximum power therom
%first thevenins therom
RL=[5 10 25 50 100 250 500];
Vth=100; Rth=50;
IL=Vth./(Rth+RL);
VL=IL.*RL;
PL=VL.*IL;
Pin=Vth.*IL;
Effi=(PL./Pin)*100;
Table=[RL',IL',VL',PL',];
disp(' resistance current voltage power');
disp(' (ohm) (amps) (volts) (watts)');
disp(Table);
semilogx(RL, PL,RL,VL,RL,IL*10,RL,Effi);
grid on;
xlabel('R (ohms)');
ylabel('P_{L} (w),V_{L} (V), 10*I_{L} (A),Effi{%}');
gtext('P_{L}');
gtext('V_{L}');
gtext('I_{L}');
gtext('Effi(%)')
Output
resistance current voltage power
(ohm) (amps) (volts) (watts)
5.0000 1.8182 9.0909 16.5289
10.0000 1.6667 16.6667 27.7778
25.0000 1.3333 33.3333 44.4444
50.0000 1.0000 50.0000 50.0000
100.0000 0.6667 66.6667 44.4444
250.0000 0.3333 83.3333 27.7778
500.0000 0.1818 90.9091 16.5289

39
Fig-3

Ex-4.3
Verification of superposition theorem:

Fig-4
Solution
Matrix form of equation of this circuit [R][I]=[V]

[ ] [ ]=[ ]
Mesh current can be calculated as
[I]=inv[R][V]
Consider V1 only V2=0 then load current
IL1=I1-I2
Consider V2 only V1=0 then load current
IL2=I1-I2
Total load current
I= IL1+IL2
The M-file developed is shown below:

40
%programe to verify superposition theorem
%experiment number six point six
R1=20; R2=10; R3=10;
V1=5; V2=10;
%Creating resistance matrix R
R=[(R1+R3) -R3; R3 -(R2+R3)];
V=[V1;V2];
I = inv(R)*V
IL = I(1)-I(2)
%now for verify superposition theorem
%consider V1 and V2=0
V3 = [V1;0]
I1 = inv(R)*V3
IL1 = I1(1)-I1(2)
%now consider V2 and V1=0
V4 = [0;V2]
I2 = inv(R)*V4
IL2=I2(1)-I2(2)
ILS=IL1+IL2
Output
I=

0.0000
-0.5000

IL =

0.5000

V3 =

5
0

I1 =

0.2000
0.1000

IL1 =

0.1000

V4 =

41
0
10

I2 =

-0.2000
-0.6000

IL2 =

0.4000

ILS =

0.5000

Ex-4.4
Plot voltage and current waveform in a resistive circuit when consider a AC source.

Fig-5

Solution
V=Vmsin(wt)
V=IR
I=V/R
The M-file developed is shown below:
% program to plot voltgae and current in a resistive circuit
%enter system parameters
V=input('enter the value of rms source voltage (in volts): ');
R=input('enter the value of resistance (in ohms): ');
f=input('enter the source frequency (in Hz): ');
n=input('enter the number of cycle for plot : ');
dt=input('enter time increment : ');
Vm=sqrt(2)*V;
Im=Vm/R;
w=2*pi*f;
T=1/f;

42
t=0:dt:n*T;
V=Vm*sin(w*t);
i=Im*sin(w*t);
plot(t,V,t,i);
grid on;
gtext('V');
gtext('i')
xlabel('time (sec)');
ylabel('v (volts) & i(amps)');

Output

Fig-6

Ex-4.6
Study of voltage and current waveforms and power factor in an inductive circuit and capacitive with
ac voltage input.

Fig-7

43
Fig-8

Solution
V=Vmsin(wt)
V=IR+LdI/dt
V=IR+1

Calculation of power factor:


PF=cos
The M-file developed is shown below:
%study of voltage and current waveforms in an resistive inductive and resistive capacitive
%circuit with AC input simplle method
f=50; w=2*pi*f; R=10; L=20e-3; Vm=100; C=1000e-6; T=1/f; n=2
XL=2*pi*f*L; XC=1/(2*pi*f*C);
Z1=(R^2+XL^2)^(1/2);
Z2=(R^2+XC^2)^(1/2);
t=0:1e-3:n*T;
V=Vm*sin(w*t);
phi1=atan(w*L/R)
pf1=cos(phi1)
phi2=atan(XC/R)
pf2=cos(phi2)
IRL=(Vm/Z1)*sin(w*t-phi1);
IRC=(Vm/Z2)*sin(w*t+phi2);
subplot(2,1,1);
plot(t,V,t,IRL);
title('Resistive inductive load curve');
xlabel('Timme(sec)');
ylabel('IRL & V');
gtext(' V ');
gtext(' IRL');
subplot(2,1,2);
plot(t,V,t,IRC);
title('Resistive capactive load curve');
xlabel('Timme(sec)');
ylabel('IRC & V');
gtext(' V ');
gtext(' IRC');

44
Output
pf1 =

0.8467

phi2 =

0.3082

pf2 =

0.9529

Fig-9

45
Ex-4.7
Write a program to plot the amplitude and phase response Frequency response of a Low Pass Filter:

Fig-10
Solution
Low-pass filter allow to low frequency. Its block to high frequency.

Vo/Vc =1/(1+jRwC)

| |= 1/
The M-file developed is shown below:
%programe to plot the amplitude and phase response of a low pass filter
R=1000;C=10e-6;
f=1:2:1000;
%describe filter voltage ratio equation
V_ratio=1./(1+j*2*pi*f*R*C);
%calculate amplitude response
amplitude=abs(V_ratio);
%calculate phase response
phase=angle(V_ratio);
%create plots
subplot(2,1,1);
loglog(f,amplitude);
grid on;
title('magnitude response');
xlabel('frequency (rad/sec)');
ylabel('voltage ratio (Vo/Vi)');
subplot(2,1,2);
semilogx(f,phase);
title('phase response');
xlabel('frequency(rad/sec)');
ylabel('phase(rad)');
grid on;

46
Output

Fig-11
Ex-4.8
Write a program to plot the amplitude and phase response Frequency response of a bandPass Filter :

Fig-12
Solution
Band-pass filter allow to range of frequency. Its block to high and low frequency.

VR=R/(R+j*(W*L-1/(W*C)))

The M-file developed is shown below:


%function script for bandpass filter in Q-6.10
function VR =fun_bandpass(R,C,L,W);

47
%define to global variable
VR=R./(R+j*(W*L-1./(W*C)));
%calculate absulate response
V1=abs(VR);
%calculate phase response
phase=angle(VR)
VR=[V1;phase];
% write scrit for bandpass filter for given figure 6.46
R=1.2e3;C=8e-6;L=5e-3;
W=10e-2:10:10e4;
%calculate amplitude and phase response
VR=fun_bandpass(R,C,L,W);
magnitude=VR(1,:);
phase=VR(2,:);
subplot(2,1,1);
loglog(W,magnitude);
title('magnitude response');
xlabel('frequency(rad/sec)');
ylabel('voltage ratio');
grid on;
subplot(2,1,2);
semilogx(W,phase);
title('phase response');
xlabel('frequency(rad/sec)')
ylabel('phase');
grid on;

Output

Fig-13

48
Ex-4.9
Write a program to plot the amplitude and phase response Frequency response of a highPass Filter :

Fig-14
Solution
High -pass filter allow to low frequency. Its block to low frequency.

VR=jwRC/(1+jwRC)
The M-file developed is shown below:
%function script for high-pass filter
function VR=fun_highpass(R,C,W);
%define global variable
VR=j*W*R*C./(1+j*W*R*C);
%calculate amplitude response
VR1=abs(VR);
%calculate phase response
phase=angle(VR);
VR=[VR1;phase];

%write script for high pass filter


R=10e3; C=1e-6;
W=10e-2:10:10e4;
%calculate magnitude response and phase response
VR=fun_highpass(R,C,W);
magnitude=VR(1,:);
phase=VR(2,:);
subplot(2,1,1);
loglog(W,magnitude);
title('magnitude response');
xlabel('frequency(rad/sec)');
ylabel('magnitude');
grid on;
subplot(2,1,2);
semilogx(W,phase);
title('phase response');
xlabel('frequency (rad/sec)');
ylabel('magnitude');
grid on;

49
Output

Fig-15
CHAPTER-5
INTRODUCTION TO SIMULINK
Ex-5.1
Plot a sinusoidal waveform (1V peak and 1rad/sec), differentiate it ,and observe both the wave form
on scope.

Solution

Fig-1

50
Output

Fig-2
Ex-5.2
Use Simulink to solve the following differential equation for :
dy/dt=10sint , y(0)=0

Solution

Fig-3
Output

51
Fig-4
Ex-5.3
Solve following differential equation using Simulink:
dy/dt = -10y+f(t) , y(0)=1

Solution
Here initial condition y(0)=1 is set in integration block parameter.

Fig-5

Output

52
Fig-6

Ex-5.4
Study the dynamic response of inductor current and capacitor voltage in a parallel R-L-C circuit
shown in fig-7 using Simulink. System parameters are R=25, L=0.2H, C=2000uF and Vs=110V.

Fig-7
Solution
Developed of system equation (Mathematical modeling)
The system equation in terms of states Vc and IL can be obtained as follows:
Ic =Is-IL

Is= (Vs-Vc)/R

Vc=1/C

IL=1/L

dVc/dt =1/C((Vs-Vc)/R-IL)

dIL/dt=1/LVc

53
Simulink block shown in fig-8:

Fig-8

Output

Fig-9

Ex-5.5
Obtain dynamic response of an armature controlled dc motor its block diagram show in fig-10 for
change speed in 500 to 1000 rpm at 0.5sec. The motor parameters are as follows : Armature resistance
Ra=2.5, armature inductance La=0.03H, moment of inertia Jm=0.022 Kgm2, coefficient of viscous
friction fm=0.00295Nms ,back emf constant Kb=1 V/(rad/sec) ,motor torque constant KT=1.2Nm/A

54
Fig-10
Solution
Simulink block shown in fig-11:

Fig-11

55
Output

fi

Fig-12
Ex-5.6
Develop a Simulink modal to generate sine and cosine waveforms of magnitude 5 and frequency 50Hz
using sine and cosine trigonometric functions.

Solution
Simulink block shown in fig-13:

Fig-13

56
Output

Fig-14
Ex-5.7
Modify the modal developed in Ex-5.6 by adding a ramp signal generator of time period

Solution
Simulink block shown in fig-15:

Fig-15

57
Output

Fig-16

58

Vous aimerez peut-être aussi