Creating an Array of X Values for Plotting a Function

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 3K views
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.