MATLAB - piecewise defined Fn as periodic

In summary, a piecewise defined function in MATLAB is a function made up of different equations for different intervals. It can be created using the "piecewise" function or "if" statements, and can be periodic using the "mod" or "rem" functions. To plot a piecewise function, the "ezplot" or "ezplot3" functions can be used. These functions can also be used for numerical calculations, but care must be taken to avoid overlapping intervals.
  • #1
Apothus
4
0

Homework Statement


We have been provided with a graph
of a function modeled by F(t)=a-aU(t-1)+(-3/2.5*t+4.2)U(t-1)-(-3/2.5*t+4.2)U(t-3.5)

I have entered this into MATLAB and it replicates the graph we have been provided with but we now need to extend this as an Even function.
 
Physics news on Phys.org
  • #2
Can't you just use F(-t) = F(t)?

What are you going to do next with this function?
 
  • #3


I would first clarify the meaning of an "Even function" in this context. An Even function is a mathematical function that satisfies the condition f(-x) = f(x) for all values of x. This means that the graph of the function is symmetric about the y-axis.

To extend the given piecewise defined function as an Even function, we can add a term that is the mirror image of the existing terms about the y-axis. This can be achieved by replacing t with -t in the original function. The resulting function would be F(t) = a - aU(-t-1) + (-3/2.5*(-t)+4.2)U(-t-1) - (-3/2.5*(-t)+4.2)U(-t-3.5).

In MATLAB, this can be represented as:

F = @(t) a - a*heaviside(-t-1) + (-3/2.5*(-t)+4.2)*heaviside(-t-1) - (-3/2.5*(-t)+4.2)*heaviside(-t-3.5)

This new function will have the same graph as the original function but will also be symmetric about the y-axis, making it an Even function. Additionally, since the original function was periodic with a period of 2.5, the extended Even function will also be periodic with the same period.

In conclusion, by adding a term that is the mirror image of the existing terms about the y-axis, we can extend the given piecewise defined function as an Even function while preserving its periodicity.
 

1. What is a piecewise defined function in MATLAB?

A piecewise defined function in MATLAB is a function that is defined by different equations over different intervals. This allows for more complex functions to be represented and evaluated in the program.

2. How do I create a piecewise defined function in MATLAB?

To create a piecewise defined function in MATLAB, you can use the "piecewise" function, which takes in multiple equations and their corresponding intervals as inputs. Alternatively, you can use "if" statements to define the function over different intervals.

3. Can piecewise defined functions be periodic in MATLAB?

Yes, piecewise defined functions can be periodic in MATLAB. This means that the function repeats itself over regular intervals. To create a periodic piecewise function, you can use the "mod" or "rem" functions to define the intervals.

4. How do I plot a piecewise defined function in MATLAB?

To plot a piecewise defined function in MATLAB, you can use the "ezplot" or "ezplot3" functions, depending on whether the function is in 2D or 3D. These functions take in the piecewise defined function as an input and automatically plot it over a specified range.

5. Can I use piecewise defined functions in MATLAB for numerical calculations?

Yes, piecewise defined functions can be used for numerical calculations in MATLAB. The program will automatically evaluate the function at a given point based on the corresponding equation for that interval. However, it is important to ensure that the intervals do not overlap to avoid incorrect calculations.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
585
  • Engineering and Comp Sci Homework Help
Replies
1
Views
952
  • Engineering and Comp Sci Homework Help
Replies
2
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
15
Views
2K
  • Introductory Physics Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
3K
Back
Top