Help with MATLAB: Rectangular Function Input & Explanation

  • Context: MATLAB 
  • Thread starter Thread starter mrlala
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary
SUMMARY

The discussion focuses on how to input a rectangular function in MATLAB, specifically the expression x=exp(t)*rect(t−1/2). Users are advised to first understand the definition of the rectangular function, which can be found on Wikipedia. The function is shifted due to the use of rect(t−0.5), requiring a redefinition of the variable T as t−0.5. Additionally, it is recommended to visualize the function's output before coding to ensure understanding and accuracy.

PREREQUISITES
  • Basic understanding of MATLAB syntax and functions
  • Familiarity with the rectangular function and its mathematical properties
  • Knowledge of function shifting in signal processing
  • Ability to plot functions in MATLAB for visualization
NEXT STEPS
  • Research how to implement the rectangular function in MATLAB using the 'rect' function
  • Learn about function shifting and its implications in signal processing
  • Explore MATLAB's plotting functions to visualize mathematical functions
  • Study the differences between continuous and discrete functions in MATLAB
USEFUL FOR

This discussion is beneficial for new MATLAB users, students learning signal processing, and anyone looking to understand the implementation of mathematical functions in programming environments.

mrlala
Messages
1
Reaction score
0
im new to MATLAB as well as this forum to. i don't know how to input rectangular function in matlab. i had search google, but it seems non of them are helpfull enough..
here is my function:
x=exp(t)*rect(t −1/2)
i have no idea to insert the part of 'rect'..
then, could anyone please explain to me what this function tells us..
cheers.
 
Physics news on Phys.org
mrlala said:
im new to MATLAB as well as this forum to. i don't know how to input rectangular function in matlab. i had search google, but it seems non of them are helpfull enough..
here is my function:
x=exp(t)*rect(t −1/2)
i have no idea to insert the part of 'rect'..
then, could anyone please explain to me what this function tells us..
cheers.
First, you need to understand the definition of the function, I've never heard of this function but a simple copy-paste fo 'rect' into Google directed me to Wikipedia! Did you even try this?
http://en.wikipedia.org/wiki/Rectangular_function
Secondly, the function is shifted because the definition is for rect(t)= rect(t-0) but you have rect(t-.5). So you need to add .5 to the conditional statements of the definition, obviously without changing the output of the function; this is equivalent to redefining T = t - .5 and applying the original rules.
Third, with a simple problem like this you need to draw the function's output before programming it; in this way, you know what to expect and if your code has any errors (or worse yet, you program it correctly but don't understand the function and therefore misdraw it).
Finally, program it; and don't post homework on this page anymore! This is a page for serious non-homework questions.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
8K
  • · Replies 5 ·
Replies
5
Views
9K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K