0% found this document useful (0 votes)
23 views1 page

Assignment 3

The document describes a MATLAB assignment involving plotting functions, writing functions, and calling functions. Students are asked to: 1) Plot two functions within specific intervals in the same figure using for loops and if statements 2) Write a function to represent a curve and call it to plot the curve over a given interval 3) Use fplot to plot the same function over the same interval

Uploaded by

Fakhar Abbas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views1 page

Assignment 3

The document describes a MATLAB assignment involving plotting functions, writing functions, and calling functions. Students are asked to: 1) Plot two functions within specific intervals in the same figure using for loops and if statements 2) Write a function to represent a curve and call it to plot the curve over a given interval 3) Use fplot to plot the same function over the same interval

Uploaded by

Fakhar Abbas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1

Southern Methodist University


School of Engineering

EE 2170 Design and Analysis Laboratory (Spring 2011)
Lab 3: Operators and Flow Control, Two-Dimensional Graphics, and Programming
in Matlab

1. Using for loops and if statements, write a MATLAB program in an m-file to plot the
following functions within the time interval [-5 5] in the same figure window in the portions
(2,1,1) and (2,1,2). Do not forget to include labels and titles on your plots.
a)

< s
=
otherwise 0
3 t 3 -
3 ) (
t
t x b)

s
< s
< s
< s +
<
=

t 4 0
4 t 2 ) 8 2 (
2 t 1
1 t 1 - ) 1 (
-1 t 0
) (
2
6
1
3
2
2
6
1
t t
t
t
t y

2. Answer to the following questions:

a. Write a MATLAB function in an m-file called myfunc.m which represents the following
curve for f(t). The function is to have input vector t and output vector y.
b. Write a MATLAB program in an m-file which calls the function myfunc and plots the
returning f(t) within the interval [-1 7].
c. Using fplot command and the defined function, myfunc, plot f(t) within the interval [-1 7].

Do not forget to include labels and titles in your plots.

Note: please include all your MATLAB programs, m-files, functions, and plots in your
report.
5 2 t
y=f(t)
-8
12
t
3
+ t
2

+ t
3

You might also like