MATLAB Creating an Array of X Values for Plotting a Function

AI Thread Summary
Creating a plot for a function over the range from negative infinity to a specific negative value R is not directly feasible in Matlab, as it does not accept infinite or NaN values in plot domains. To address this limitation, one effective approach is to compactify the domain by selecting a finite range that approximates the desired interval. This involves rescaling the function to fit within the new finite domain, allowing for a valid plot representation.
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 (-\infty,-R) 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
Views
2K
Replies
1
Views
5K
Replies
4
Views
2K
Replies
8
Views
2K
Replies
3
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
1
Views
3K
Replies
3
Views
3K
Back
Top