Borrar filtros
Borrar filtros

Reason for line not plotting?

1 visualización (últimos 30 días)
1582251394
1582251394 el 9 de Sept. de 2018
Editada: madhan ravi el 9 de Sept. de 2018
x = 1:10:100;
y = (((20*x+35000)/(70))-1)/x;
plot(x,y)
I was wondering why the above code does not plot the function, y? As soon as the x is put in the denominator the function refuses to plot.
  2 comentarios
jonas
jonas el 9 de Sept. de 2018
Try
./
Instead of
/
Stephen23
Stephen23 el 9 de Sept. de 2018
y = (((20*x+35000)/(70))-1)./x;
^^ you need this!
You need to learn about array and matrix operations:

Iniciar sesión para comentar.

Respuesta aceptada

madhan ravi
madhan ravi el 9 de Sept. de 2018
Editada: madhan ravi el 9 de Sept. de 2018
Use element wise operation because as you defined x as a vector you should use dot it means each element is calculated one by one.
x = 1:10:100;
y = (((20*x+35000)/(70))-1)./x;
plot(x,y)
  1 comentario
madhan ravi
madhan ravi el 9 de Sept. de 2018
Editada: madhan ravi el 9 de Sept. de 2018
if it solved the issue, please accept the answer

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by