views:

215

answers:

1

Plot the function f(x) = 1.5x / x-4 for -10 equal or less than X equal or less than 10. Notice that the function have a vertical asymptote at x = 4. Plot the function by creating two vectors for the domain of x. The first vector (call it x1) with elements from -10 to 3.7, and the second vector (calle it x2) with elements from 4.3 to 10. For each of the X vector create a Y vector (call them y1 and y2) with the corresponding values of Y according to the function. To plot the function make two curves in the same plot (y1 vs. x1 and y2 vs. x2).

+3  A: 

Learn how to create vectors in Matlab. First look at the colon(:) operator, which creates vectors, if you know start, step and end values. Look also at LINSPACE function, if you don't need to know how far the points in a vector are, but how many points do you need. It will help you to create vectors x1 and x2.

Then learn how to do arithmetic calculations in MATLAB. Create vectors y1 and y2.

Then create the plot with PLOT function. You may need to use HOLD ON, HOLD OFF to draw two curves on the same figure.

yuk
This should be enough information to figure out the problem.
Jonas

related questions