Creating an Array of X Values for Plotting a Function

Click For Summary
SUMMARY

To create a plot of a function for all x values between negative infinity and a specified negative R value in MATLAB, one cannot directly use Inf or NaN as valid points. Instead, the solution involves compactifying the domain of the function to a finite range. By rescaling the function over this new finite domain, users can effectively visualize the desired plot without encountering domain errors.

PREREQUISITES
  • Understanding of MATLAB plotting functions
  • Familiarity with function domain and range concepts
  • Knowledge of mathematical rescaling techniques
  • Basic experience with array manipulation in MATLAB
NEXT STEPS
  • Learn MATLAB array creation techniques for finite ranges
  • Research mathematical rescaling methods for function visualization
  • Explore MATLAB's plotting functions and their limitations
  • Investigate alternative plotting libraries for handling infinite domains
USEFUL FOR

Mathematics students, data scientists, and engineers who need to visualize functions in MATLAB, particularly those dealing with complex domains and plotting challenges.

airelemental135
Messages
13
Reaction score
0
I want to create a plot of a given function for all x values between negative infinite to negative R (for some given R value). How do I create an array for x so that my plot will include all the x values?
 
Physics news on Phys.org
airelemental135 said:
I want to create a plot of a given function for all x values between negative infinite to negative R (for some given R value). How do I create an array for x so that my plot will include all the x values?

You can't plot on a range [itex](-\infty,-R)[/itex] since Matlab won't accept Inf or NaN as valid points in the domain of a plot.

Of course, you can overcome this simply by compactifying the domain of your function to a finite domain, and then plotting the rescaled function over the new domain.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K