How to add a domain to a variable when we are using the plot function?


For example, I would like to draw a graph of y=2*x but I just want some part of the full graph. Adding a domain to the variable x is needed, but I tried some ways, they all didn’t work.

So how to use the function to draw the graph like y=2*x and x is ranged from 2 to 4.
[ps. There is something wrong with the uploaded, so I cannot share my picture from my picture library.]




The window=fit allows the x & y axes to be scaled independently.


But It seems that the graph is only displayed in some part. Can the part that I don’t want be erased from the graph which means what the result shows me is a line segment instead of a infinite curve?


i am puzzled by your last question. The Plot command I showed is for the range of 2 to 4 as you asked. There is no “infinite range”. X goes from 2 to 4 and y goes from 4 10 16. (See below).

If you can add code & screen shot, it will make it easier to understand what you are referring to…


Oh! I think I see what you want now. For that you want Parametric Plot.


I recently found a way to do this by messing around. Here is the trick.

Lets use your question as an example;
To restrict the domain of y=2*x where x=[2,4]

Go to Mathstudio and type:
Thats all there is to it!

If you would like to know more on how this works or to use the script I created to make it simple to use, click the DomainPlotv1.math file.

P.S. I uploaded it to the share section (I Think).
Anyway Enjoy! :slight_smile:

DomainPlot v1.math (2.4 KB)

DomainPlot() with functions with conditional statements

Thank you!! That is exactly what I want!!